Database class abstract interface Database

A Couchbase Lite database.

Implemented types
Implementers

Properties

config DatabaseConfiguration
The configuration which was used to open this database.
no setter
defaultCollection FutureOr<Collection>
The default Collection of this database.
no setter
defaultScope FutureOr<Scope>
The default Scope of this database.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClosed bool
Whether this resource has been closed.
no setterinherited
name String
The name of this database.
no setter
path String?
The path to this database.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopes FutureOr<List<Scope>>
The Scopes of this database.
no setter

Methods

changeEncryptionKey(EncryptionKey? newKey) FutureOr<void>
Encrypts or decrypts a Database, or changes its EncryptionKey.
close() Future<void>
Closes this database.
override
collection(String name, [String scope = Scope.defaultName]) FutureOr<Collection?>
Returns the Collection with the given name in the given scope.
collections([String scope = Scope.defaultName]) FutureOr<List<Collection>>
Returns all the Collections in the given scope.
createCollection(String name, [String scope = Scope.defaultName]) FutureOr<Collection>
Creates a Collection with the given name in the specified scope.
createQuery(String query, {bool json = false}) FutureOr<Query>
Creates a Query from a query string.
delete() Future<void>
Closes and deletes this database.
deleteCollection(String name, [String scope = Scope.defaultName]) FutureOr<void>
Deletes the Collection with the given name in the given scope.
getBlob(Map<String, Object?> properties) FutureOr<Blob?>
Gets a Blob using its metadata.
inBatch(FutureOr<void> fn()) Future<void>
Runs a group of database operations in a batch.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performMaintenance(MaintenanceType type) FutureOr<void>
Performs database maintenance.
saveBlob(Blob blob) FutureOr<void>
Saves a Blob directly into this database without associating it with any Documents.
scope(String name) FutureOr<Scope?>
Returns the Scope with the given name.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

defaultDirectory String
The default directory used by database APIs when no directory is specified explicitly.
getter/setter pair
log Log
Configuration of the ConsoleLogger, FileLogger and a custom Logger.
final
prediction Prediction
Manager for registering and unregistering PredictiveModels.
final

Static Methods

copy({required String from, required String name, DatabaseConfiguration? config}) Future<void>
Copies a canned database from the given path to a new database with the given name and config.
copySync({required String from, required String name, DatabaseConfiguration? config}) → void
Copies a canned database from the given path to a new database with the given name and config.
exists(String name, {String? directory}) Future<bool>
Checks whether a database of the given name exists in the given directory or not.
existsSync(String name, {String? directory}) bool
Checks whether a database of the given name exists in the given directory or not.
openAsync(String name, [DatabaseConfiguration? config]) Future<AsyncDatabase>
Opens a Couchbase Lite database with the given name and config, which executes in a separate worker isolate.
openSync(String name, [DatabaseConfiguration? config]) SyncDatabase
Opens a Couchbase Lite database with the given name and config, which executes in the current isolate.
remove(String name, {String? directory}) Future<void>
Deletes a database of the given name in the given directory.
removeSync(String name, {String? directory}) → void
Deletes a database of the given name in the given directory.
resetDefaultDirectory() → void
Resets defaultDirectory to its automatically resolved value.