Serhat ZENGİN
Serhat ZENGİN

Reputation: 56

How could I enter third string to List<Map<String, String>> on Flutter?

  List<Map<String, String>> splashData = [
        {"text": "EGZERSİZİNİ SEÇ", "image": "assets/logo/Splash1.png"},
        {"text": "TELEFONUNU SABİTLE", "image": "assets/logo/Splash2.png"},
       {"text": "UYARI", "image": "assets/logo/Splash3.png"}
    ];

I'am trying to add 3 Strings to List in Flutter. How could I third string to my List?

Example I want to make

   List<Map<String, String, String> splashData :[
           {"text": "EGZERSİZİNİ SEÇ", "image": "assets/logo/Splash1.png","text1": "EGZERSİZİNİ SEÇ"},
           {"text": "TELEFONUNU SABİTLE", "image": "assets/logo/Splash2.png","text1":"EGZERSİZİNİ SEÇ"},
          {"text": "UYARI", "image": "assets/logo/Splash3.png","text1": "EGZERSİZİNİ SEÇ"}];

Is this possible to add?

Thanks for respond.

Upvotes: 0

Views: 85

Answers (2)

ahmetakil
ahmetakil

Reputation: 908

splashData.forEach( (data) => data['text1'] = "EGZERSİZİNİ SEÇ"));

Upvotes: 0

quoci
quoci

Reputation: 3557

You can add a key with a value just like that.

for(final Map<String, String> data in splashData){
  data['text1'] = 'EGZERSİZİNİ SEÇ';
}

Upvotes: 1

Related Questions