Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Dart - simple yield and yield* example
Stream<String> otherNumbers() {
return Stream.fromIterable(["2", "3"]);
}
Stream<String> allNumbers() async* {
yield "1";
yield* otherNumbers();
}
main() async {
allNumbers().listen((e) => print(e));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment