Skip to content

Instantly share code, notes, and snippets.

@lbv
Created May 8, 2019 14:23
Show Gist options
  • Save lbv/89bf5afd9bd4b2375e5d9c5d3b5d3048 to your computer and use it in GitHub Desktop.
Save lbv/89bf5afd9bd4b2375e5d9c5d3b5d3048 to your computer and use it in GitHub Desktop.
class SomeState {
int counter = 0;
Stream<int> stream() async* {
yield counter += 1;
yield counter += 1;
print('at the end of stream counter is $counter');
}
}
void main() {
final state = SomeState();
state.stream().listen((x) => print('received $x'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment