FakeSyncClock class

Mutable clock for deterministic time in tests.

Pass call as the engine clock, then move time forward explicitly:

final clock = FakeSyncClock(DateTime.utc(2026, 1, 1));
final engine = SyncEngine(
  store: InMemorySyncStore(),
  transport: FakeSyncTransport(),
  clock: clock.call,
);

clock.advance(const Duration(minutes: 1));

Constructors

FakeSyncClock(DateTime now)
Creates a clock frozen at now.

Properties

hashCode int
The hash code for this object.
no setterinherited
now DateTime
The current test time.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

advance(Duration duration) → void
Moves now forward by duration.
call() DateTime
Returns now; matches the engine's Clock signature.
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