FakeClock class final

A Clock whose value is advanced by the caller. Used everywhere in animation tests; never use SystemClock in tests.

final clock = FakeClock();
// ... wire clock into a TickerScheduler / Ticker / etc.
clock.advance(const Duration(milliseconds: 100));
// any ticker is now 100ms further along its timeline.
Implemented types

Constructors

FakeClock([Duration initial = Duration.zero])

Properties

hashCode → int
The hash code for this object.
no setterinherited
now → Duration
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

advance(Duration delta) → void
Advances the clock by delta. Asserts delta is non-negative to preserve the monotonic-time invariant.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
set(Duration time) → void
Sets the clock to time. Asserts that the new value is at least as large as the current value.
toString() → String
A string representation of this object.
inherited

Operators

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