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? _defs, String? directoryPath, {bool queriesCaseSensitiveDefault = true})
Attach to a store opened in the directoryPath (or if null the defaultDirectoryPath).
Store.fromReference(ModelDefinition? _defs, ByteData _reference, {bool queriesCaseSensitiveDefault = true})
Create a Dart store instance from an existing native store reference.

Properties

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

Methods

awaitAsyncCompletion() bool
Await for all (including future) async submissions to be completed (the async queue becomes idle for a moment).
awaitAsyncSubmitted() bool
Await for previously submitted async operations to be completed (the async 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.
runIsolated<P, R>(TxMode mode, FutureOr<R> callback(Store, P), P param) Future<R>
Deprecated. Use runAsync instead. Will be removed in a future release.
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!
getter/setter pair

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 (or if null the defaultDirectoryPath).

Constants

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