percentRemaining method
Returns the percentage of cooldown time remaining as a value between 0.0 and 1.0.
Returns 0.0 if the cooldown has expired or was never activated. Returns 1.0 if the cooldown was just activated.
Implementation
Future<double> percentRemaining() async {
final remaining = await timeRemaining();
final ratio = remaining.inMilliseconds / duration.inMilliseconds;
return ratio.clamp(0.0, 1.0);
}