runtimeState property

FastModeRuntimeState get runtimeState

Get the current fast mode runtime state, checking for cooldown expiry.

Implementation

FastModeRuntimeState get runtimeState {
  if (_runtimeState is FastModeCooldown) {
    final cooldown = _runtimeState as FastModeCooldown;
    if (DateTime.now().millisecondsSinceEpoch >= cooldown.resetAt) {
      if (isFastModeEnabled && !_hasLoggedCooldownExpiry) {
        _hasLoggedCooldownExpiry = true;
        cooldownExpired.emit();
      }
      _runtimeState = const FastModeActive();
    }
  }
  return _runtimeState;
}