Skip to content

Instantly share code, notes, and snippets.

@danielgomezrico
Created February 5, 2021 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielgomezrico/d0eb1225faf04f52197c0a7c76298f2f to your computer and use it in GitHub Desktop.
Save danielgomezrico/d0eb1225faf04f52197c0a7c76298f2f to your computer and use it in GitHub Desktop.
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