Created
June 30, 2020 12:18
-
-
Save doug-orchard/909a3585074720930e6e13c8816b8125 to your computer and use it in GitHub Desktop.
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'; | |
int handleData(int data) { | |
return data * 2; | |
} | |
void main() { | |
final controller = StreamController<int>(); | |
controller.stream | |
.map(handleData) | |
.listen((data) { | |
print('data: $data'); | |
}); | |
controller.add(1); | |
controller.add(2); | |
controller.add(3); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment