Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Bloc counter
enum CounterEvent { increment }
class CounterBloc extends Bloc<CounterEvent, int> {
CounterBloc() : super(0);
Stream<int> mapEventToState(CounterEvent event) async* {
switch (event) {
case CounterEvent.increment:
yield state + 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment