Skip to content

Instantly share code, notes, and snippets.

@alphamikle
Created January 31, 2021 14:05
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/b79b1e42fc38dd8b35391065103ed7c2 to your computer and use it in GitHub Desktop.
Save alphamikle/b79b1e42fc38dd8b35391065103ed7c2 to your computer and use it in GitHub Desktop.
Backend sync mode
class FirstBackend extends Backend<Events, void> {
FirstBackend(BackendArgument<void> argument) : super(argument);
int counter = 0;
/// Or, you can simply return a value
Future<int> _decrement(int diff) async {
counter -= diff;
return counter;
}
@override
Map<Events, Function> get operations => {
Events.decrement: _decrement,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment