PersistState<T> class

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?
getter/setter pair
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.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
key → String
String identifer to be use to store the state
final
persistOn ↔ PersistOn?
Enum to determine when to persist the state:
getter/setter pair
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.
no setterinherited
shouldRecreateTheState → bool?
Determines whether the state builder function should be invoked after the persistent 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.
getter/setter pair

Methods

delete() → Future<void>
Delete the persisted state
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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