Created
February 2, 2019 09:35
-
-
Save happyharis/6762f616dcc2205db26666011d32d0a6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class RestaurantBloc implements BlocBase { | |
RestaurantBloc() { | |
chef.stream.listen(cookOrder); | |
} | |
String currentOrder; | |
final waiter = StreamController(); | |
Sink get tray => waiter.sink; | |
Stream get deliverFood => waiter.stream; | |
final chef = StreamController(); | |
Stream get customerOrders => chef.stream; | |
cookOrder(customerOrder) { | |
currentDoor = customerOrder.cook(); | |
tray.add(customerOrder); | |
} | |
@override | |
void dispose() { | |
chef.close(); | |
waiter.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment