LogBuffer class

A bounded, observable record of captured stray output. The oldest lines are dropped once capacity is exceeded. Notifies listeners on each append so a log view can repaint.

Inheritance

Constructors

LogBuffer({int capacity = 1000})

Properties

baseIndex → int
Index of the oldest retained line in the totalAdded sequence. Equal to totalAdded - length; survives capacity head trims.
no setter
capacity → int
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether at least one listener is registered.
no setterinherited
isEmpty → bool
no setter
length → int
no setter
lines → List<LogLine>
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
totalAdded → int
Monotonic count of lines ever appended (including ones trimmed from the head). Stable entry ids are baseIndex + list index.
no setter

Methods

add(LogLine line) → void
addListener(VoidCallback listener) → void
Registers listener to be called when this object changes.
inherited
dispose() → void
Marks this notifier as disposed and drops its listeners. Nulls the slots in place (rather than replacing the backing list) so a dispose called from within a listener leaves any in-progress notify walk reading valid, now-empty slots. After disposal, addListener and notify throw; removeListener remains safe for cleanup.
override
listen(VoidCallback listener) → VoidCallback
Registers listener and returns an idempotent cancellation function.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify() → void
Publishes a change to every listener registered when the pass began.
inherited
removeListener(VoidCallback listener) → void
Removes a previously-registered listener.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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