Created
February 5, 2021 19:56
-
-
Save danielgomezrico/d0eb1225faf04f52197c0a7c76298f2f to your computer and use it in GitHub Desktop.
Dart - simple yield and yield* example
This file contains 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
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