Skip to content

Instantly share code, notes, and snippets.

@alphamikle
Created January 31, 2021 14:04
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/1c81f7b7a0a801028da8bf37cc535924 to your computer and use it in GitHub Desktop.
Save alphamikle/1c81f7b7a0a801028da8bf37cc535924 to your computer and use it in GitHub Desktop.
Frontend processing
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