PausableValueNotifier<T> class

A ValueNotifier, which allows clients to pause new value notifications.

When paused, the value property returns whatever the value was when this PausableValueNotifier was paused, regardless of the latest values that was set on this PausableValueNotifier.

Pausing notifications is useful when a series of changes might occur in rapid succession, and only the final value is relevant to listeners.

For example, consider a user's selection in an editor. A single user interaction might result in any number of commands and reactions executing, which might alter the user's selection multiple times within a single frame of execution. None of these intermediate selection values are relevant to the rest of the editor. In fact, if the rest of the editor was notified of these transient selection values, then the rest of the editor might do things that it shouldn't do, and cause the editor to enter an inconsistent state.

Instead, a PausableValueNotifier lets the editor pipeline disable notifications as it runs the pipeline, and then re-enable notifications when all commands and reactions are done executing.

Inheritance

Constructors

PausableValueNotifier(T value)

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value ↔ T
The current value stored in this notifier.
getter/setter pairoverride

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
pauseNotifications() → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
resumeNotifications() → void
toString() String
A string representation of this object.
inherited

Operators

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