FakeClock class

A deterministic clock for tests.

Pass clock.now to a LoggerConfig.clock field to make every event stamped with a controlled timestamp. Advance time by calling advance or set it explicitly with setNow.

Constructors

FakeClock([DateTime? start])
Creates a fake clock starting at start, or at the steno test epoch (2026-01-01T00:00:00Z) if not specified.

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 delta) → void
Advances the clock by delta.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
now() DateTime
The current fake "now". Pass this method as clock.now to a LoggerConfig.
setNow(DateTime value) → void
Replaces the current "now" with value.
toString() String
A string representation of this object.
inherited

Operators

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