Created
January 31, 2021 14:04
-
-
Save alphamikle/1c81f7b7a0a801028da8bf37cc535924 to your computer and use it in GitHub Desktop.
Frontend processing
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 { | |
decrement, | |
} | |
class FirstState with ChangeNotifier, Frontend<Events> { | |
int counter = 0; | |
Future<void> decrement([int diff = 1]) async { | |
counter = await runBackendMethod<int, int>(Events.decrement, diff); | |
} | |
/// Automatically notification after any event from backend | |
@override | |
void onBackendResponse() { | |
notifyListeners(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment