Store class

Represents an ObjectBox database and works together with Box to allow getting and putting.

Available Extensions

Constructors

Store(ModelDefinition modelDefinition, {String? directory, int? maxDBSizeInKB, int? fileMode, int? maxReaders, int? debugFlags, bool queriesCaseSensitiveDefault = true, String? macosApplicationGroup})
Creates a BoxStore using the model definition from your objectbox.g.dart file in the given directory path (or if null the defaultDirectoryPath).
Store.attach(ModelDefinition modelDefinition, String? directoryPath, {bool queriesCaseSensitiveDefault = true})
Attach to a store opened in the directoryPath (or if null the defaultDirectoryPath).
Store.fromReference(ModelDefinition modelDefinition, ByteData _reference, {bool queriesCaseSensitiveDefault = true})
Create a Dart store instance from an existing native store reference.

Properties

directoryPath String
Path to the database directory.
read-only
hashCode int
The hash code for this object.
read-onlyinherited
reference ByteData
Returns a store reference you can use to create a new store instance with a single underlying native store. See Store.fromReference for more details.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

awaitQueueCompletion() bool
Await for all (including future) submissions using Box.putQueued to be completed (the queue becomes idle for a moment).
awaitQueueSubmitted() bool
Await for previously submitted operations using Box.putQueued to be completed (the queue does not have to become idle).
box<T>() Box<T>
Returns a cached Box instance.
close() → void
Closes this store.
isClosed() bool
Returns if this store is already closed and can no longer be used.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
runAsync<P, R>(RunAsyncCallback<P, R> callback, P param) Future<R>
Spawns an isolate, runs callback in that isolate passing it param with its own Store and returns the result of callback.
runInTransaction<R>(TxMode mode, R fn()) → R
Executes a given function inside a transaction. Returns fn's result. Aborts a transaction and rethrows on exception if fn is asynchronous.
runInTransactionAsync<R, P>(TxMode mode, TxAsyncCallback<R, P> callback, P param) Future<R>
Like runAsync, but executes callback within a read or write transaction depending on mode.
syncClient() SyncClient?
Return an existing SyncClient associated with the store or null if not available. Use Sync.client() to create one first.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

debugLogs bool
Enables a couple of debug logs. This meant for tests only; do not enable for releases!
read / write

Static Methods

isOpen(String? directoryPath) bool
Returns if an open store (i.e. opened before and not yet closed) was found for the given directoryPath.

Constants

defaultDirectoryPath → const String
Path of the default directory, currently 'objectbox'.
'objectbox'