FakeTickerScheduler class

Test variant of TickerScheduler that doesn't create a real Timer.periodic. Tests drive ticks by:

  1. Advancing the FakeClock passed in via the constructor.
  2. Calling advanceFrame to invoke registered callbacks.

isActive reflects whether registrations would have started the real timer — useful for the "zero idle work" structural assertion.

Inheritance

Constructors

FakeTickerScheduler({Duration frameInterval = const Duration(milliseconds: 33), required FakeClock clock})

Properties

activeTickerCount → int
Number of currently registered callbacks. Used by stress tests to assert "no ticker leak."
no setterinherited
clock → Clock
no setterinherited
frameInterval → Duration
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
isActive → bool
Whether the scheduler currently has a periodic source running. Structural assertion target: should be false when no callbacks are registered, true while at least one is.
no setteroverride
onFrameStart ← void Function()?
no getterinherited
onPostFrameCallbackRegistered ↔ void Function()?
getter/setter pairinherited
reassembleCallbackCount → int
Number of currently registered reassemble callbacks.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addPostFrameCallback(FrameCallback callback) → void
Queues callback to fire once, after the next rendered frame's bytes have been emitted (in the runtime) or after the next FleuryTester.pump completes its build flush (in tests). A callback registered DURING a drain enqueues for the next frame — never re-entrantly within the same drain.
inherited
advance(Duration delta) → void
Convenience: advance the fake clock by delta and emit one scheduler tick at the new time. Equivalent to:
advanceFrame() → void
Drives one scheduler tick, calling every registered callback with the clock's current now. No-op when the scheduler is not active (i.e. no callbacks registered).
dispose() → void
Releases scheduler resources. Idempotent. Tickers that were registered with this scheduler should be disposed first; after dispose the scheduler will not invoke any callbacks.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reassemble() → void
Fires every registered reassemble callback. Called by the shared runtime after the build owner has rebuilt the element tree.
inherited
register(SchedulerTickCallback callback) → void
Registers callback to receive a clock reading on every tick. Idempotent: re-registering the same callback is a no-op. Starts the underlying periodic source if this was the first callback.
inherited
registerReassembleCallback(VoidCallback callback) → void
Registers callback to fire on the next reassemble. Idempotent: re-registering the same callback is a no-op.
inherited
toString() → String
A string representation of this object.
inherited
unregister(SchedulerTickCallback callback) → void
Unregisters a previously-registered callback. No-op when callback isn't currently registered. Stops the underlying periodic source if no callbacks remain.
inherited
unregisterReassembleCallback(VoidCallback callback) → void
Unregisters a previously-registered reassemble callback. No-op when callback isn't currently registered.
inherited

Operators

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