TokenBudget class

Tracks a token budget with reservation support.

Constructors

TokenBudget({required int total, int used = 0})

Properties

hashCode int
The hash code for this object.
no setterinherited
isExhausted bool
Whether the budget has been fully consumed.
no setter
percentage double
Usage as a percentage (0.0 to 1.0).
no setter
remaining int
Number of tokens still available.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
total int
Maximum number of tokens allowed.
final
used int
Number of tokens consumed so far.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
release(int amount) → void
Releases amount tokens back to the budget.
reserve(int amount) bool
Reserves amount tokens from the budget.
toString() String
A string representation of this object.
override

Operators

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