Streams
A Stream delivers many values over time. await for and listen consume it.
Example
Stream<int> count(int n) async* {
for (var i = 1; i <= n; i++) {
yield i;
}
}
void main() async {
await for (final x in count(3)) {
print(x);
}
}Exercise
Consume a stream.
await (var x in s)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.