Skip to content

Instantly share code, notes, and snippets.

@jtmuller5
Created March 25, 2021 04:15
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 jtmuller5/5c7732c638fd9c24b469cc793aa79893 to your computer and use it in GitHub Desktop.
Save jtmuller5/5c7732c638fd9c24b469cc793aa79893 to your computer and use it in GitHub Desktop.
Future<void> incrementCounter(String key) async {
AtKey atKey = AtKey();
atKey.key = key;
/// Share with the other sign
if(shareWith) {
atKey.sharedWith = AtConstants().atMap[atProtocolService.currentAtSign];
}
counter++;
await atProtocolService.atClientImpl.put(atKey, counter.toString());
if (key == 'one') {
/// This line enables this @sign to notify another @sign
await atProtocolService.atClientImpl.notify(atKey, counter.toString(), OperationEnum.update);
one = counter.toString();
} else if (key == 'two') {
two = counter.toString();
} else if (key == 'three') {
three = counter.toString();
}
notifyListeners();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment