PersistentPod<T> class
A specialized WhalePod that automatically syncs its value to device local storage. Supported Types: String, int, double, bool, and List<String>.
- Inheritance
-
- Object
- ChangeNotifier
- WhalePod<
T> - PersistentPod
- Available extensions
Constructors
- PersistentPod(String key, T defaultValue)
Properties
- defaultValue → T
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- key → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value ↔ T
-
The current value of the object. When the value changes, the callbacks
registered with addListener will be invoked.
getter/setter pairinherited-getteroverride-setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
call(
[dynamic newValue = _marker]) → T -
Callable support! e.g.
counter()to get, andcounter(10)to set.inherited -
debounce(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackwhen the value changes, but only afterdurationhas passed without any further changes. Extremely useful for search fields to avoid spamming an API. -
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
-
ever(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackevery time the value changes. Returns a function that cancels the listener. -
interval(
Duration duration, void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackat most once everydurationupon changes. Useful to restrict the firing rate of rapid events (e.g. scroll metrics). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notify(
) → void -
Expose explicitly to process batched changes internally.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
once(
void callback(T value)) → VoidCallback -
Available on WhalePod<
CallsT> , provided by the PodWorkers extensioncallbackonly once, the next time the value changes. -
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
-
watch(
BuildContext context) → T -
Registers context to explicitly rebuild when the pod value changes.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited