xxxxxxxxxx
import 'dart:async';
void main() {
Stream<int> myFunction() async* {
yield* Stream.periodic(
Duration(seconds: 1), (computationCount) => computationCount++);
}
myFunction().listen((event) {
print(event);
});
}
//output
0
1
2
3
4
5
.
.
.
.
.
.