PrefNotifier<T> class

Inheritance

Constructors

PrefNotifier(String key, {T initFunc()?, dynamic checkValue})

Properties

checkValue CheckValueFunc<T?>?
An optional callback that will be called before changing the value or saving a new value to the storage.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
initialized Future<PrefItem<T>>
Future completes when the object initialization completes. That means we have read value or NULL from the storage.
no setterinherited
initializedValue Future<T?>
Allows to wait when for the first value being asynchronously read after object creation.
no setterinherited
isDisposed bool
Returns true after dispose was called.
no setterinherited
isInitialized bool
no setterinherited
key String
The current item key (or name, or id - depending on the storage).
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
storage PrefsStorage
The parent storage containing the current item.
finalinherited
value ↔ T?
The current value stored in this notifier.
getter/setter pairinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
adjust(AdjustFunc f) Future<T?>
Reads an existing value, computes a new one with AdjustFunc and writes the new value to the storage.
inherited
defined() Future<bool>
Returns TRUE if we have the value in storage, otherwise FALSE.
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
read() Future<T?>
Reads and returns the data from storage. value property will also be updated.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() String
A string representation of this object.
inherited
toWaitList(List<Future> list) → void
inherited
write(T? value) Future<void>
inherited

Operators

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

Static Properties

commonStorage SharedPrefsStorage
no setter