Persistor<T> class Null safety

Persistor class that saves/loads to/from disk.

Constructors

Persistor({required StorageEngine storage, required StateSerializer<T> serializer, Transforms<T>? transforms, RawTransforms? rawTransforms, bool debug = false, Duration? throttleDuration = Duration.zero, bool shouldSave(Store<T> store, dynamic action)?})

Properties

debug bool
Debug mode (prints debug information).
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
rawTransforms RawTransforms?
Transformations on raw data to be applied on save/load.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
serializer StateSerializer<T>
State serialized used to serialize the state to/from bytes.
final
shouldSave → (bool Function?(Store<T> store, dynamic action)?)
Function that if not null, returns if an action should trigger a save.
final
storage StorageEngine
Storage engine to save/load from/to.
final
throttleDuration Duration?
Duration for which to throttle saving. Disable by setting to null. It is recommended to set a duration of a few (2-5) seconds to reduce storage calls, while preventing data loss. A duration of zero (default) will try to save on next available cycle
read / write
transforms Transforms<T>?
Transformations on state to be applied on save/load.
final

Methods

createMiddleware() Middleware<T>
Middleware used for Redux which saves on each action.
load() Future<T?>
Load state from storage
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
save(T state) Future<void>
Save state to storage.
toString() String
A string representation of this object. [...]
inherited

Operators

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