PersistState<T> class Null safety

State persistence setting.


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.


cachedJson String?
read / write
catchPersistError bool
Whether to catch error of read, delete and deleteAll methods.
debugPrintOperations bool
Debug print an informative message on the Read, Write, Delete operations
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
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.
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. [...]
throttleDelay int?
The throttle delay in milliseconds. The state is persisted once at the end of the given delay.
toJson ↔ (String Function?(T s)?)
Callback that exposes the current state and returns a String representation of the state. [...]
read / write


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


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