SharedValue<T > class
Properties
$
↔ T
The value held by this state.
getter/setter pair
autosave
→ bool
automatically save to shared preferences when the value changes
final
customDecode
→ T Function(String ? val ) ?
customize decode function, null idicates the key not existing in storage
final
customEncode
→ String ? Function(T val ) ?
customize encode function, returning null indicates removing the key from storage
final
customLoad
→ Future <T > Function() ?
customize load function
final
customSave
→ Future <void > Function(T val ) ?
customize save function
final
hashCode
→ int
The hash code for this object.
no setter inherited
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 setter inherited
stream
→ Stream <T >
A stream of $ s that gets updated everytime the internal value is changed.
no setter
streamWithInitial
→ Stream <T >
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, update $ 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 >