elapse method

Future<void> elapse(
  1. Duration time
)

Forces elapsing all timers that are less than or equal to duration time.

After each timers is elapsed, this implicitly calls update, awaiting any pending microtasks, and returns a future that completes when both all timers and microtasks are completed.

May throw TimersWillNotCompleteError.

Implementation

Future<void> elapse(Duration time) async {
  final waitUntil = _lastElapse + time;
  await _completeTimers((t) => t._completeAfter <= waitUntil);
  _lastElapse = waitUntil;
}