BudgetTracker class

Tracks current usage against a MissionBudget and detects breaches.

Constructors

BudgetTracker(MissionBudget budget, {DateTime? startedAt})

Properties

budget → MissionBudget
final
calls → int
no setter
elapsed → Duration
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tokens → int
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
record({required String toolClass, int tokens = 0, Duration duration = Duration.zero}) → BudgetBreach?
Records a tool call of toolClass consuming tokens tokens and duration of per-tool-class time. Returns the first BudgetBreach detected, or null if no budget was breached.
toString() → String
A string representation of this object.
inherited
usedForClass(String toolClass) → Duration
Cumulative duration used by toolClass so far.

Operators

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