PersistState<T> class Null safety

State persistence setting.

Constructors

PersistState({required String key, String toJson(T s)?, FutureOr<T> fromJson(String json)?, PersistOn? persistOn, int? throttleDelay, bool catchPersistError = false, bool debugPrintOperations = false, IPersistStore? persistStateProvider, bool? shouldRecreateTheState})
State persistence setting.

Properties

cachedJson String?
read / write
catchPersistError bool
Whether to catch error of read, delete and deleteAll methods.
final
debugPrintOperations bool
Debug print an informative message on the Read, Write, Delete operations
final
fromJson ↔ (FutureOr<T> Function?(String json)?)
Optional callback that exposes the String representation of the state and returns the parsed state. [...]
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
key String
String identifer to be use to store the state
final
persistOn PersistOn?
Enum to determine when to persist the state: [...]
read / write
persistStateProvider IPersistStore?
Persistance provider that will be used to persist this state instead of the default persistance provider defined with RM.storageInitializer.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
shouldRecreateTheState bool?
Determines whether the state builder function should be invoked after the persistant state has been loaded or not. [...]
final
throttleDelay int?
The throttle delay in milliseconds. The state is persisted once at the end of the given delay.
final
toJson ↔ (String Function?(T s)?)
Callback that exposes the current state and returns a String representation of the state. [...]
read / write

Methods

delete() Future<void>
Delete the persisted state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
read() Object?
Get the persisted state
setPersistStateSingleton() → void
toString() String
A string representation of this object. [...]
inherited
write(T value) Future<void>
persist the state

Operators

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