reset static method

Future<void> reset(
  1. String eventKey
)

Resets an event's state.

This method clears all tracking data for the event and cancels any active timers. The event will start fresh the next time it's tracked.

It handles:

  • Resetting event counter
  • Canceling active timers
  • Clearing last trigger times
  • Updating state

Returns a Future that completes when the reset is done.

Implementation

static Future<void> reset(String eventKey) async {
  await _eventCounter.resetEvent(eventKey);
  _timers[eventKey]?.cancel();
  _timers.remove(eventKey);
  _lastTriggerTimes.remove(eventKey);
  _timeUpdateTimers[eventKey]?.cancel();
  _timeUpdateTimers.remove(eventKey);
  final config = _configs[eventKey];
  if (config != null) {
    config.onStateUpdate?.call(false);
  }
}