Skip to content

Instantly share code, notes, and snippets.

@frencojobs
Created September 4, 2020 09:56
Show Gist options
  • Save frencojobs/87ef24e150a5beb49b5bfa24a652c683 to your computer and use it in GitHub Desktop.
Save frencojobs/87ef24e150a5beb49b5bfa24a652c683 to your computer and use it in GitHub Desktop.
Me trying my best to explain yield* syntax of dart.
Iterable<int> inner() sync* {
for (final i in [4, 5, 6]) {
yield i;
}
}
Iterable<int> outer() sync* {
for (final i in [1, 2, 3]) {
yield i;
}
yield* inner();
}
void main() {
for (final i in outer()) {
print(i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment