Skip to content

Instantly share code, notes, and snippets.

@Aetet
Last active July 7, 2019 13:14
Show Gist options
  • Save Aetet/026f78becd6743000ed39a32767255fa to your computer and use it in GitHub Desktop.
Save Aetet/026f78becd6743000ed39a32767255fa to your computer and use it in GitHub Desktop.
Async stream vs broadcast
import 'dart:async';
void main() {
final controller = new StreamController<int>();
controller.add(10);
controller.stream.listen((a) => print('receive: $a'));
final contrtoller2 = new StreamController<int>.broadcast();
contrtoller2.add(20);
contrtoller2.stream.listen((b) => print('receive $b'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment