percentElapsed method
Computes and returns the progress as a percentage of the reset window.
Returns a double between 0.0
and 1.0
indicating the progress of
the current reset window, or null
if the last update time is not available.
Implementation
Future<double?> percentElapsed() async {
final last = await lastUpdate.get();
if (last == null) return null;
final elapsed = DateTime.now().difference(last);
return (elapsed.inMilliseconds / resetEvery.inMilliseconds).clamp(0.0, 1.0);
}