next method
Implementation
void next([NornsDuration timerEndPoint = NornsDuration.zero]) {
if (isNotFired) {
if (_timers.isEmpty) {
throw StateError('timer is not exist, please add one timer at least.');
}
_increaseIndex();
_running = RunningNornsTimer(
timer: _timers[_currentRunningTimerIndex],
startedAt: NornsDuration.zero,
);
return;
}
assert(_running != null);
final r = running!;
final currentTimerRecord = NornsTimerRecord(
timer: r.timer,
startedAt: r.startedAt,
endAt: timerEndPoint,
);
_done.add(currentTimerRecord);
_increaseIndex();
if (isFinished) {
_currentRunningTimerIndex = timers.length;
_running = null;
return;
}
_running = RunningNornsTimer(
timer: _timers[_currentRunningTimerIndex],
startedAt: currentTimerRecord.endAt,
);
}