TokenMeter class

A one-line context-window meter: used/limit token counts, a utilization bar, and a percentage (Context: 78k/200k [####......] 39%). From warningThreshold of the limit (80% by default) it adds NEAR LIMIT, and from errorThreshold (95% by default) OVER LIMIT — words, not color alone, so the state reads in monochrome.

Inheritance
Available extensions

Constructors

TokenMeter({Key? key, required TokenUsage usage, String label = 'Context', int width = 10, double warningThreshold = 0.8, double errorThreshold = 0.95})
const

Properties

errorThreshold → double
Context-usage ratio at which the over-limit state begins.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
finalinherited
label → String
Visible and semantic label placed before the usage value.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
usage → TokenUsage
Token and context-window metrics to display.
final
warningThreshold → double
Context-usage ratio at which the near-limit state begins.
final
width → int
Number of cells used by the utilization bar; zero hides the bar.
final

Methods

animate({Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate

Available on Widget, provided by the AnimateExtension extension

Starts an Animate chain over this widget. duration / curve apply to the whole chain. With no trigger it plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes.
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates the Element that will mount this widget into the tree.
inherited
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