isCooldownActive method

Future<bool> isCooldownActive()

Returns true if the cooldown is still active.

A cooldown is active if it has been activated and the specified duration has not yet elapsed.

Implementation

Future<bool> isCooldownActive() async {
  final last = await _lastActivated.get();
  if (last == null) return false;
  return DateTime.now().isBefore(last.add(duration));
}