RestorableListenable<T extends Listenable> class Null safety

A base class for creating a RestorableProperty that stores and restores a Listenable.

This class may be used to implement a RestorableProperty for a Listenable, whose information it needs to store in the restoration data change whenever the Listenable notifies its listeners.

The RestorationMixin this property is registered with will call toPrimitives whenever the wrapped Listenable notifies its listeners to update the information that this property has stored in the restoration data.

Inheritance
Implementers

Constructors

RestorableListenable()

Properties

enabled bool
Whether the object currently returned by toPrimitives should be included in the restoration state.
read-onlyinherited
hashCode int
The hash code for this object.
read-onlyinherited
hasListeners bool
Whether any listeners are currently registered.
protected">@protectedread-onlyinherited
isRegistered bool
Whether this property is currently registered with a RestorationMixin.
protected">@protectedread-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
state State<StatefulWidget>
The State object that this property is registered with.
protected">@protectedread-onlyinherited
value → T
The Listenable stored in this property.
read-only

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
createDefaultValue() → T
Called by the RestorationMixin if no restoration data is available to restore the value of the property from to obtain the default value for the property.
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).
override
fromPrimitives(Object? data) → T
Called by the RestorationMixin to convert the data previously retrieved from toPrimitives back into an object of type T that this property should wrap.
inherited
initWithValue(T value) → void
Called by the RestorationMixin with the value returned by either createDefaultValue or fromPrimitives to set the value that this property currently wraps.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
protected">@protectedvisibleForTesting">@visibleForTestinginherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toPrimitives() Object?
Called by the RestorationMixin to retrieve the information that this property wants to store in the restoration data.
inherited
toString() String
A string representation of this object.
inherited

Operators

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