incCounter method

Future<int> incCounter(
  1. String key
)

Increment a named counter by one and return the new value.

Implementation

Future<int> incCounter(String key) async {
  final next = (_counters[key] ?? 0) + 1;
  _counters[key] = next;
  await _persist();
  return next;
}