TuiAppStateHolder<S extends TuiState> class abstract

Provides access to the shared TuiState and a way to trigger rebuilds on the currently mounted TuiAppState.

The backend mutates state directly, then calls markDirty to schedule a rebuild. This avoids proxying every mutation method and survives NoctermApp rebuilds that recreate the widget state.

Constructors

TuiAppStateHolder()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state → S
Shared state that can be mutated.
no setter
widgetState TuiAppState<TuiApp<TuiAppStateHolder<TuiState>>>?
The currently mounted widget state, if not null. This is used to trigger rebuilds.
no setter

Methods

attach(covariant TuiAppState<TuiApp<TuiAppStateHolder<TuiState>>> widgetState) → void
Attaches to a mounted widget state.
detach(covariant TuiAppState<TuiApp<TuiAppStateHolder<TuiState>>> widgetState) → void
Detaches from an unmounted widget state.
dispose() Future<void>
Releases the dirty-event stream. The holder typically lives for the process lifetime, but tests that construct it directly should call this so the subscription doesn't outlive the test.
markDirty() → void
Schedule a rebuild on the currently mounted state. Coalesced via a throttled stream; see _rebuildInterval.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showAlert(AlertMessage alert, {DateTime? time}) → void
Shows alert, replacing any previous one. A copyable segment is copied to the clipboard immediately. time is shown alongside the alert.
toString() String
A string representation of this object.
inherited

Operators

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