Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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