SharedValue<T> class

Constructors

SharedValue({String? key, required T value, bool autosave = false})

Properties

$ ↔ T
The value held by this state.
getter/setter pair
autosave bool
automatically save to shared preferences when the value changes
final
hashCode int
The hash code for this object.
no setterinherited
key String?
The key to use for storing this value in shared preferences.
final
nonce double?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T>
A stream of $s that gets updated everytime the internal value is changed.
no setter

Methods

deserialize(String str) → T
desrialize str to an obj of type T for shared preferences.
load() Future<void>
Try to load the value stored at key in shared preferences. If no value is found, return immediately. Else, udpdate $ and rebuild dependent widgets if it changed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
of(BuildContext? context) → T
Get the value held by this state, and also rebuild the widget in context whenever mutate is called.
save() Future<void>
Store the current $ at key in shared preferences.
serialize(T obj) String
serialize obj of type T for shared preferences.
setIfChanged(T value) → void
Set $ to value, but only if they're different
setState<R>([R? fn()?]) → R?
Rebuild all dependent widgets.
toString() String
A string representation of this object.
inherited
update(T fn(T)) → void
Set $ to the return value of fn, and rebuild the dependent widgets if it changed.
waitUntil(bool predicate(T)) Future<T>

Operators

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

Static Properties

didWrap bool
getter/setter pair
random Random
final
stateManager StateManagerWidgetState
latefinal
stateNonceMap Map<SharedValue, double>
final

Static Methods

wrapApp(Widget app) Widget
Initalize Shared value.