whenExpires method

Future<void> whenExpires()

Completes when the cooldown expires.

If the cooldown is already expired or was never activated, this future completes immediately.

Implementation

Future<void> whenExpires() async {
  final remaining = await timeRemaining();
  if (remaining > Duration.zero) {
    await Future.delayed(remaining);
  }
}