Created
July 8, 2019 16:31
-
-
Save myanmarlinks/1c11ed44c797eb502686544c9c2d83d3 to your computer and use it in GitHub Desktop.
Dart Basic Part 4
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
import 'dart:async'; | |
void main() { | |
var streamController = StreamController<String>.broadcast( | |
onListen: () => print('onListen'), | |
onCancel: () => print("onCancel"), | |
); | |
StreamSubscription sub = streamController.stream.listen( | |
(data) => print('Got $data'), | |
onError: (err) => print("Got $err"), | |
onDone: () => print("Done!") | |
); | |
StreamSubscription sub2 = streamController.stream.listen((data) => print("My $data")); | |
streamController.sink.add("Myanmar Links"); | |
sub.pause(); | |
sub.resume(); | |
streamController.sink.add("Flutter Application Devloper"); | |
streamController.sink.addError("Something went wrong"); | |
streamController.sink.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment