Skip to content

Instantly share code, notes, and snippets.

@lukas-h
Created November 3, 2021 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukas-h/efcb64e4b47821306e66716e2319d973 to your computer and use it in GitHub Desktop.
Save lukas-h/efcb64e4b47821306e66716e2319d973 to your computer and use it in GitHub Desktop.
Future<void> main() async {
// List/Iterable:
var array = [1,2,3,4];
array.forEach(print);
for(var item in array) {
print(item);
}
// Stream:
var stream = Stream.fromIterable(array);
stream.forEach(print);
await for(var item in stream) {
print(item);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment