Answers for "how to iterate a map in dart"

1

dart loop through map

main() {
  var numMap = Map();
  numMap["one"] = 1;
  numMap["two"] = 2;
  numMap["three"] = 3;
  numMap["four"] = 4;
  numMap["five"] = 5;

  numMap.forEach((k, v) => print("Key : $k, Value : $v"));
}
Posted by: Guest on March-05-2021
1

dart map foreach

void main() { 
   var usrMap = {"name": "Tom", 'Email': '[email protected]'}; 
   usrMap.forEach((k,v) {
     print('${k}: ${v}');
   }); 
}
Posted by: Guest on April-03-2021
0

dart map.foreach

void main(){
	Map Sample = {"foo": "bar"};
    Sample.forEach((key, value){
    	print("The Key is: '$key' for Value '$value'");
    });
}
Posted by: Guest on November-13-2021

Browse Popular Code Answers by Language