DatabaseUniverse class abstract

An DatabaseUniverse database instance.

Available extensions

Constructors

DatabaseUniverse.new()

Properties

directory String
The directory containing the database file.
no setter
hashCode int
The hash code for this object.
no setterinherited
isOpen bool
Whether this instance is open and active.
no setter
name String
Name of the instance.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
schemas List<DatabaseUniverseSchema>
Get the schemas of all collections and embedded objects in this instance.
no setter

Methods

changeEncryptionKey(String encryptionKey) → void
Changes the encryption key for an encrypted database. Only supported on engines with encryption encryption support, and for databases that are already encrypted.
clear() → void
Remove all data in this instance.
close({bool deleteFromDisk = false}) bool
Releases an DatabaseUniverse instance.
collection<ID, OBJ>() DatabaseUniverseCollection<ID, OBJ>
Get a collection by its type.
collectionByIndex<ID, OBJ>(int index) DatabaseUniverseCollection<ID, OBJ>
Get a collection by its index.
copyToFile(String path) → void
Copy a compacted version of the database to the specified file.
getKeyDirectoryName() String

Available on DatabaseUniverse, provided by the DatabaseUniverseExtension extension

General Library Documentation Undocument By General Corporation & Global Corporation & General Developer
getSize({bool includeIndexes = false}) int
Returns the size of all the collections in bytes.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read<T>(T callback(DatabaseUniverse databaseUniverse)) → T
Create a synchronous read transaction.
readAsync<T>(T callback(DatabaseUniverse databaseUniverse), {String? debugName}) Future<T>
Create an asynchronous read transaction.
readAsyncWith<T, P>(P param, T callback(DatabaseUniverse databaseUniverse, P param), {String? debugName}) Future<T>
Create an asynchronous read transaction and pass a parameter to the callback.
toString() String
A string representation of this object.
inherited
verify() → void
Verifies the integrity of the database. This method is not intended to be used by end users and should only be used by DatabaseUniverse tests. Never call this method on a production database.
write<T>(T callback(DatabaseUniverse databaseUniverse)) → T
Create a synchronous read-write transaction.
writeAsync<T>(T callback(DatabaseUniverse databaseUniverse), {String? debugName}) Future<T>
Create an asynchronous read-write transaction.
writeAsyncWith<T, P>(P param, T callback(DatabaseUniverse databaseUniverse, P param), {String? debugName}) Future<T>
Create an asynchronous read-write transaction and pass a parameter to the callback.

Operators

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

Static Properties

currentVersion ↔ PackageVersionNumberGeneralLibrary
The current DatabaseUniverse version.
getter/setter pair
packageVersion ↔ PackageVersionNumberGeneralLibrary
The current DatabaseUniverse version.
getter/setter pair

Static Methods

fastHash(String string) int
FNV-1a 64bit hash algorithm optimized for Dart Strings
get({required List<DatabaseUniverseGeneratedSchema> schemas, String name = DatabaseUniverse.defaultName}) DatabaseUniverse
Get an already opened DatabaseUniverse instance by its name.
initialize({String? sharedLibraryPath, bool ignoreCheckVersion = false}) FutureOr<void>
Initialize DatabaseUniverse manually. This is required if you target web.
open({required List<DatabaseUniverseGeneratedSchema> schemas, required String directory, String name = DatabaseUniverse.defaultName, DatabaseUniverseEngine engine = DatabaseUniverseEngine.databaseUniverse, int? maxSizeMiB = DatabaseUniverse.defaultMaxSizeMiB, String? encryptionKey, CompactCondition? compactOnLaunch, bool inspector = true}) DatabaseUniverse
Open a new DatabaseUniverse instance.
openAsync({required List<DatabaseUniverseGeneratedSchema> schemas, required String directory, String name = DatabaseUniverse.defaultName, DatabaseUniverseEngine engine = DatabaseUniverseEngine.databaseUniverse, int? maxSizeMiB = DatabaseUniverse.defaultMaxSizeMiB, String? encryptionKey, CompactCondition? compactOnLaunch, bool inspector = true}) Future<DatabaseUniverse>
Open a new DatabaseUniverse instance asynchronously.

Constants

defaultMaxSizeMiB → const int
The default max DatabaseUniverse size.
defaultName → const String
The default DatabaseUniverse instance name.
sqliteInMemory → const String
Use this value for the directory parameter to create an in-memory database.