tryActivate method

Future<bool> tryActivate()

Attempts to activate the cooldown only if it is not currently active.

Returns true if the cooldown was activated (meaning it was not active before). Returns false if the cooldown was already active and no action was taken.

This is a convenience method that combines checking and activating in one call.

Implementation

Future<bool> tryActivate() async {
  if (await isExpired()) {
    await activateCooldown();
    return true;
  }
  return false;
}