FilePersistor class

A worker abstraction that creates a background worker isolate to process file persistence/hydration.

Inheritance

Constructors

FilePersistor({FilePersistorSettings? settings, void onPersist(Set<Document> batch)?, void onClear(Set<Collection> collections)?, void onClearAll()?, void onHydrate(HydrationData data)?, void onSync()?, Duration persistenceThrottle = const Duration(milliseconds: 100)})

Properties

hashCode int
The hash code for this object.
no setterinherited
onClear → void Function(Set<Collection> collections)?
finalinherited
onClearAll → void Function()?
finalinherited
onHydrate → void Function(HydrationData data)?
finalinherited
onPersist → void Function(Set<Document> batch)?
finalinherited
onSync → void Function()?
final
persistenceThrottle Duration
The throttle for batching persisted documents. All documents updated within the throttle duration are batched together into a single persist operation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
settings PersistorSettings
finalinherited

Methods

clear(Set<Collection> collections) Future<void>
Clear function used to clear all documents under the given collections.
override
clearAll() Future<void>
Clears all documents and removes all persisted data.
override
hydrate([Set<StoreReference>? refs]) Future<HydrationData>
Hydration function called to read data from persistence. If no entities are specified, then it hydrations all persisted data. if entities are specified, it hydrates only the data from the paths under those entities.
override
init() Future<void>
Public APIs to be implemented by any Persistor extension like FilePersistor.
override
initDirectory() Future<Directory>
Initializes the directory in which files are persisted. This needs to be done on the main isolate as opposed to the worker since it requires access to plugins that are not easily available in the worker isolate context.
initEncrypter() Future<Encrypter?>
Initializes the encrypter used for encrypting files. This needs to be done on the main isolate as opposed to the worker since it requires access to plugins that are not easily available in the worker isolate context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
persist(Set<Document> docs) Future<void>
Persist function called with the bath of documents that have changed (including been deleted) within the last throttle window specified by the Persistor.persistenceThrottle duration.
override
toString() String
A string representation of this object.
inherited

Operators

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