StateSubscription<T> class

Manages the connection between a state and the elements depending on it.

This class acts as a bridge that registers event listeners, tracks active watchers and readers, and disposes of the state once it has no dependents.

Constructors

StateSubscription({required ValueNotifier<T> notifier, required VoidCallback listener, dynamic onDispose(T)?})

Properties

hashCode int
The hash code for this object.
no setterinherited
listener VoidCallback
The callback listener that triggers whenever the state notifies changes.
final
notifier ValueNotifier<T>
The active state notifier instance being managed.
final
onDispose → dynamic Function(T)?
The callback invoked with the current state value when this subscription is disposed.
final
readers Set<Element>
Elements only reading this state.
final
referenceCount int
The total number of dependent elements (both readers and watchers) relying on this state.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
watchers Set<Element>
Elements actively watching this state.
final

Methods

cancel() → void
Unbinds the listener from the notifier, stopping future update notifications.
dispose() → void
Cancels the subscription and releases all resources associated with the state.
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