Skip to content

Instantly share code, notes, and snippets.

@bergwerf
Created August 21, 2018 12:59
Show Gist options
  • Save bergwerf/251be93f743fbe547505d502fdb73d43 to your computer and use it in GitHub Desktop.
Save bergwerf/251be93f743fbe547505d502fdb73d43 to your computer and use it in GitHub Desktop.
Dart Iterable.where and Iterable.map lazyness test
void main() {
final data = new List.generate(100, (i) => i);
final result = data.where((i) {
print('where $i');
return i > 0 && i % 10 == 0;
}).map((i) {
print('map $i');
return i / 10;
});
print('==========');
print(result.first);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment