Skip to content

Instantly share code, notes, and snippets.

@alphamikle
Created January 31, 2021 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alphamikle/c1df04fe624a75363fc783b8ff9125d7 to your computer and use it in GitHub Desktop.
Save alphamikle/c1df04fe624a75363fc783b8ff9125d7 to your computer and use it in GitHub Desktop.
Events
enum Events {
increment,
}
class FirstState with Frontend<Events> {
int counter = 0;
void increment([int diff = 1]) {
send(Events.increment, diff);
}
void _setCounter(int value) {
counter = value;
notifyListeners();
}
@override
Map<Events, Function> get tasks => {
Events.increment: _setCounter,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment