FakeTimer class

An implementation of Timer that's controlled by a FakeAsync.

Periodic timers attempt to be isochronous. They trigger as soon as possible after a multiple of the duration has passed since they started, independently of when prior callbacks actually ran. This behavior matches VM timers.

Repeating web timers instead reschedule themselves a duration after their last callback ended, which shifts the timing both if a callback is delayed or if it runs for a long time. In return it guarantees that there is always at least duration between two callbacks.

Implemented types

Properties

creationStackTrace StackTrace
The current stack trace when this timer was created.
no setter
debugString String
Returns debugging information to try to identify the source of the Timer.
no setter
duration Duration
If this is periodic, the time that should elapse between firings of this timer.
final
hashCode int
The hash code for this object.
no setterinherited
isActive bool
Returns whether the timer is still active.
no setteroverride
isPeriodic bool
Whether this is a periodic timer.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tick int
The number of durations preceding the most recent timer event.
no setteroverride

Methods

cancel() → void
Cancels the timer.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited