Skip to content

Instantly share code, notes, and snippets.

@bergwerf
Last active September 21, 2018 12:27
Show Gist options
  • Save bergwerf/3acb9ce5fbfd5de22af893ff1dd10bf4 to your computer and use it in GitHub Desktop.
Save bergwerf/3acb9ce5fbfd5de22af893ff1dd10bf4 to your computer and use it in GitHub Desktop.
Dart WhereIterable does not cache
void main() {
final mappedIterable = ['a', 'b', 'c', 'd'].map((ch) {
print('mapped $ch');
return ch;
}).where((ch) {
return ch != 'a';
});
if (mappedIterable.isNotEmpty) {
print('iterable is non-empty');
print(mappedIterable.first);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment