reset method

  1. @override
Future<void> reset()
override

Resets the counter value to zero and updates the last update timestamp to the start of the current period.

This method ensures thread-safe operation using a lock.

Implementation

@override
Future<void> reset() => _lock.synchronized(() async {
      await Future.wait([
        value.set(0),
        lastUpdate.set(period.alignedStart(DateTime.now())),
      ]);
    });