Store class

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

Available Extensions


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.


directoryPath String
Path to the database directory.
hashCode int
The hash code for this object.
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.
runtimeType Type
A representation of the runtime type of the object.


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.
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.


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

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.


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