AsyncDatabase class Null safety Database

A Database with a primarily asynchronous API.

Implemented types

Constructors

AsyncDatabase()

Properties

config DatabaseConfiguration
The configuration which was used to open this database.
read-only, inherited
count Future<int>
The total number of documents in the database.
read-only, override
hashCode int
The hash code for this object. [...]
read-only, inherited
indexes Future<List<String>>
The names of all existing indexes.
read-only, override
isClosed bool
Whether this resource has been closed.
read-only, inherited
name String
The name of this database.
read-only, inherited
path String?
The path to this database. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

addChangeListener(DatabaseChangeListener listener) Future<ListenerToken>
Adds a listener to be notified of all changes to Documents in this database. [...]
override
addDocumentChangeListener(String id, DocumentChangeListener listener) Future<ListenerToken>
Adds a listener to be notified of changes to the Document with the given id. [...]
override
changeEncryptionKey(EncryptionKey? newKey) Future<void>
Encrypts or decrypts a Database, or changes its EncryptionKey. [...]
override
changes() AsyncListenStream<DatabaseChange>
Returns a Stream to be notified of all changes to Documents in this database. [...]
override
close() Future<void>
Closes this database. [...]
inherited
createIndex(String name, Index index) Future<void>
Creates a value or full-text search index with the given name. [...]
override
delete() Future<void>
Closes and deletes this database. [...]
inherited
deleteDocument(Document document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) Future<bool>
Deletes a document from this database, resolving conflicts through ConcurrencyControl. [...]
override
deleteIndex(String name) Future<void>
Deletes the Index of the given name.
override
document(String id) Future<Document?>
Returns the Document with the given id, if it exists.
override
documentChanges(String id) AsyncListenStream<DocumentChange>
Returns a Stream to be notified of changes to the Document with the given id. [...]
override
getDocumentExpiration(String id) Future<DateTime?>
Gets the expiration date of a Document by its id, if it exists.
override
inBatch(FutureOr<void> fn()) Future<void>
Runs a group of database operations in a batch. [...]
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
performMaintenance(MaintenanceType type) Future<void>
Performs database maintenance.
override
purgeDocument(Document document) Future<void>
Purges a document from this database. [...]
override
purgeDocumentById(String id) Future<void>
Purges a Document from this database by its id. [...]
override
removeChangeListener(ListenerToken token) Future<void>
Removes a previously added change listener. [...]
override
saveDocument(MutableDocument document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) Future<bool>
Saves a document to this database, resolving conflicts through ConcurrencyControl. [...]
override
saveDocumentWithConflictHandler(MutableDocument document, SaveConflictHandler conflictHandler) Future<bool>
Saves a document to this database, resolving conflicts with a conflictHandler. [...]
override
setDocumentExpiration(String id, DateTime? expiration) Future<void>
Sets an expiration date for a Document by its id. [...]
override
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited
operator [](String id) Future<DocumentFragment>
Returns the DocumentFragment for the Document with the given id.
override

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. [...]
override
exists(String name, {String? directory}) Future<bool>
Checks whether a database of the given name exists in the given directory or not.
override
open(String name, [DatabaseConfiguration? config]) Future<AsyncDatabase>
Opens a Couchbase Lite database with the given name and config, which executes in a separate worker isolate. [...]
remove(String name, {String? directory}) Future<void>
Deletes a database of the given name in the given directory.
override