Answers for "for each in dart"

4

foreach loop in list in dart

main() {
    List<String> list = new List<String>();
    list.add('one');
    list.add('two');
    list.add('twelve');
    list.forEach((element) => print(element));

    Set<String> set = Set.from(list);
    set.forEach((element) => print(element));    
}
Posted by: Guest on May-28-2020
1

dart foreach

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

Code answers related to "Dart"

Browse Popular Code Answers by Language