Created
August 14, 2020 07:52
-
-
Save dllewellyn/aae90e6987fbb3cfe3833481d0ebbd5a to your computer and use it in GitHub Desktop.
Bloc_sample
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
enum CounterEvent { increment } | |
class CounterBloc extends Bloc<CounterEvent, int> { | |
CounterBloc() : super(0); | |
@override | |
Stream<int> mapEventToState(CounterEvent event) async* { | |
switch (event) { | |
case CounterEvent.increment: | |
yield state + 1; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment