Skip to content

Instantly share code, notes, and snippets.

@ZaidSameer
Forked from aruld/foreachlistset.dart
Created April 4, 2022 18:43
Show Gist options
  • Save ZaidSameer/6e8162691cf0b1edd089356d953305b3 to your computer and use it in GitHub Desktop.
Save ZaidSameer/6e8162691cf0b1edd089356d953305b3 to your computer and use it in GitHub Desktop.
Dart forEach() on a List/Set
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));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment