SembastPersistence<I> class
A persistence provider implementing Sembast-backed local document storage.
I is the type of the document ID.
- Inheritance
-
- Object
- PersistenceProvider<
I> - SembastPersistence
Constructors
- SembastPersistence({String databasePath = './', SembastCodec? codec, DatabaseFactory? databaseFactory})
-
Creates a new SembastPersistence with the specified
databasePath,codec, and optionaldatabaseFactory.
Properties
- codec → SembastCodec?
-
Optional codec used for Sembast encryption or custom formats.
final
- databasePath → String
-
The local directory path where Sembast files will be stored.
final
-
ensureInitialized
→ Future<
void> -
Released when
initializedSuccessfullyis called. IfinitializedWithErroris called, throws the given exception.no setterinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- isInitialized → bool
-
Simply checks if the object is initialized at the moment.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
whenInitialized
→ Stream<
void> -
Fired when
initializedSuccessfullyis called. IfinitializedWithErroris called, the given exception is passed to theonErrorcallback.no setterinherited -
whenUninitialized
→ Stream<
void> -
Fired when
markAsUninitializedis called.no setterinherited
Methods
-
acquireWriteLock(
Collection< I> collection, Duration timeout) → Future<bool> -
Lock writes on Sembast using an asynchronous transaction block.
override
-
dispose(
) → Future< void> -
Disposes resources, closing all active Sembast databases.
override
-
initializedSuccessfully(
) → void -
Marks that the object has been initialized successfully.
inherited
-
initializedWithError(
{Object? error, String? message, StackTrace? stackTrace}) → void -
Marks that the object was initialized with an error.
inherited
-
markAsUninitialized(
) → void -
Marks that the object is again not initialized. After this, you can call
initializedSuccessfullyagain.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onCollectionChanged(
DataTransfer< I> change) → Future<void> -
Publishes changes to the persistence layer.
override
-
readAllData(
Collection< I> collection) → Future<void> -
Loads all documents in the collection from Sembast.
override
-
readSchema(
String databaseName, SchemaInfo schemaInfo) → Future< SchemaInfo> -
Loads the persisted database schema version from Sembast.
override
-
reinitialize(
Future future(), {bool callInitializedWithErrorOnException = true}) → Future -
Allows to reinitialize the object with the call of the given future.
inherited
-
releaseWriteLock(
Collection< I> collection) → Future<void> -
Releases the lock on Sembast.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
writeAllData(
Collection< I> collection) → Future<void> -
Overwrites the collection documents in Sembast.
override
-
writeSchema(
String databaseName, SchemaInfo schemaInfo) → Future< void> -
Saves the database schema version to Sembast.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited