AgentRunClock class

Measures how long a run worked, for "Thought for 6s".

It works like a Stopwatch: start begins or resumes, stop pauses or ends, and reset returns to zero. Stop it while the run waits for an approval, so time the reader spends deciding does not count as thinking.

Listeners hear start, stop and reset; the clock does not tick.

Inheritance

Constructors

AgentRunClock({Duration now()?})
Creates a stopped clock at zero.

Properties

elapsed → Duration
The time measured so far, including the current stretch.
no setter
elapsedSeconds → int
elapsed in whole seconds, rounded up, as the AI Elements reasoning summary counts them: any measured time reads as at least one second.
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isRunning → bool
Whether the clock is measuring.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
reset() → void
Stops and returns to zero, for a new run.
start() → void
Begins measuring, or resumes after stop.
stop() → void
Pauses measuring and keeps the time measured so far.
toString() → String
A string representation of this object.
inherited

Operators

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