elapse method
Simulates the asynchronous passage of time.
This should only be called from within the zone used by run.
If duration
is negative, the returned future completes with an
ArgumentError.
If a previous call to elapse has not yet completed, throws a StateError.
Any Timers created within the zone used by run which are to expire
at or before the new time after duration
has elapsed are run.
The microtask queue is processed surrounding each timer. When a timer is
run, the clock
will have been advanced by the timer's specified
duration. Calls to elapseBlocking from within these timers and
microtasks which cause the clock
to elapse more than the specified
duration
, can cause more timers to expire and thus be called.
Once all expired timers are processed, the clock
is advanced (if
necessary) to the time this method was called + duration
.
Implementation
void elapse(Duration duration);