Skip to content

Instantly share code, notes, and snippets.

@alphamikle
Created January 31, 2021 14:01
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/e8d6cc6a3ff227c7809ad8aa0d8dce0d to your computer and use it in GitHub Desktop.
Save alphamikle/e8d6cc6a3ff227c7809ad8aa0d8dce0d to your computer and use it in GitHub Desktop.
Frontend with backend
/// Frontend part
Future<void> decrement([int diff = 1]) async {
counter = await runBackendMethod<int, int>(Events.decrement, diff);
}
/// -----
/// Backend part
Future<int> _decrement(int diff) async {
counter -= diff;
return counter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment