advance method
Moves the clock forward by duration and wakes due delays.
duration must not be negative. Zero is allowed and wakes delays that
are already due.
Implementation
void advance(Duration duration) {
if (duration.isNegative) {
throw ArgumentError.value(duration, 'duration', 'Must not be negative');
}
_now = _now.add(duration);
final due = _waiters.where((waiter) => !waiter.time.isAfter(_now)).toList();
for (final waiter in due) {
_waiters.remove(waiter);
if (!waiter.completer.isCompleted) waiter.completer.complete();
}
}