reset method
void
reset(
{ - int? newDuration,
- int? newInitialDuration,
})
Implementation
void reset({int? newDuration, int? newInitialDuration}) {
stop();
if (newDuration != null) {
if (newDuration <= 0) {
throw EfficientCircularCountdownTimerException('duration must be > 0');
}
duration = newDuration;
}
if (newInitialDuration != null) {
if (newInitialDuration < 0) {
throw EfficientCircularCountdownTimerException(
'initialDuration must be >= 0',
);
}
if (newInitialDuration > duration) {
throw EfficientCircularCountdownTimerException(
'initialDuration must be <= duration',
);
}
_currentSeconds = newInitialDuration;
} else {
_currentSeconds = initialDuration;
}
timeNotifier.value = _defaultFormatter(_currentSeconds);
}