Created
January 31, 2021 14:03
-
-
Save alphamikle/c1df04fe624a75363fc783b8ff9125d7 to your computer and use it in GitHub Desktop.
Events
This file contains 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 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