Skip to content

Instantly share code, notes, and snippets.

@happyharis
Created February 2, 2019 09:35
Show Gist options
  • Save happyharis/6762f616dcc2205db26666011d32d0a6 to your computer and use it in GitHub Desktop.
Save happyharis/6762f616dcc2205db26666011d32d0a6 to your computer and use it in GitHub Desktop.
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