Created
June 8, 2018 09:08
-
-
Save tejainece/7a7a55bada6a97ed1bc4221606592e4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
Stream<int> stream() async* { | |
int k = 0; | |
while (k < 10) yield k++; | |
} | |
void main() async { | |
await for(int i in stream()) { | |
print('Starting $i ...'); | |
await new Future.delayed(new Duration(seconds: 2)); | |
print('Finishing $i ...'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment