FixedClock class
A test-only clock whose time is set explicitly.
final clock = FixedClock(DateTime.utc(2025));
clock.advance(const Duration(minutes: 5));
- Implemented types
Constructors
- FixedClock(DateTime _now)
-
Creates a clock pinned to
_now.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
advance(
Duration duration) → void -
Moves the clock forward by
duration. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
now(
) → DateTime -
Returns the current wall-clock time.
override
-
setTime(
DateTime time) → void -
Replaces the current time with
time. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited