SyncDatabase class abstract Database

A Database with a primarily synchronous API.

Implemented types

Constructors

SyncDatabase(String name, [DatabaseConfiguration? config])
Opens a Couchbase Lite database with the given name and config, which executes in the current isolate.
factory

Properties

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

Methods

addChangeListener(DatabaseChangeListener listener) ListenerToken
Adds a listener to be notified of all changes to Documents in this database.
override
addDocumentChangeListener(String id, DocumentChangeListener listener) ListenerToken
Adds a listener to be notified of changes to the Document with the given id.
override
changeEncryptionKey(EncryptionKey? newKey) → void
Encrypts or decrypts a Database, or changes its EncryptionKey.
override
changes() Stream<DatabaseChange>
Returns a Stream to be notified of all changes to Documents in this database.
inherited
close() Future<void>
Closes this database.
inherited
createIndex(String name, Index index) → 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]) bool
Deletes a document from this database, resolving conflicts through ConcurrencyControl.
override
deleteIndex(String name) → void
Deletes the Index of the given name.
override
deleteTypedDocument(TypedDocumentObject<Object> document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) bool
Deletes a typed document from this database, resolving conflicts through ConcurrencyControl.
override
document(String id) Document?
Returns the Document with the given id, if it exists.
override
documentChanges(String id) Stream<DocumentChange>
Returns a Stream to be notified of changes to the Document with the given id.
inherited
getBlob(Map<String, Object?> properties) Blob?
Gets a Blob using its metadata.
override
getDocumentExpiration(String id) 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.
inherited
inBatchSync(void fn()) → void
Runs a group of database operations in a batch, synchronously.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
performMaintenance(MaintenanceType type) → void
Performs database maintenance.
override
purgeDocument(Document document) → void
Purges a document from this database.
override
purgeDocumentById(String id) → void
Purges a Document from this database by its id.
override
purgeTypedDocument(TypedDocumentObject<Object> document) → void
Purges a typed document from this database.
override
removeChangeListener(ListenerToken token) → void
Removes a previously added change listener.
override
saveBlob(Blob blob) Future<void>
Saves a Blob directly into this database without associating it with any Documents.
override
saveDocument(MutableDocument document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) bool
Saves a document to this database, resolving conflicts through ConcurrencyControl.
override
saveDocumentWithConflictHandler(MutableDocument document, SaveConflictHandler conflictHandler) FutureOr<bool>
Saves a document to this database, resolving conflicts with a conflictHandler.
inherited
saveDocumentWithConflictHandlerSync(MutableDocument document, SyncSaveConflictHandler conflictHandler) bool
Saves a document to this database, resolving conflicts with an sync conflictHandler.
saveTypedDocument<D extends TypedDocumentObject<Object>, MD extends TypedMutableDocumentObject<TypedDocumentObject<Object>, TypedDocumentObject<Object>>>(TypedMutableDocumentObject<D, MD> document) SyncSaveTypedDocument<D, MD>
Creates and returns an object, which can be used to save a typed document to this database.
override
setDocumentExpiration(String id, DateTime? expiration) → void
Sets an expiration date for a Document by its id.
override
toString() String
A string representation of this object.
inherited
typedDocument<D extends TypedDocumentObject<Object>>(String id) → D?
Returns the typed document, with type D and the given id, if it exists.
override

Operators

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

Static Methods

copy({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.
override
exists(String name, {String? directory}) bool
Checks whether a database of the given name exists in the given directory or not.
override
remove(String name, {String? directory}) → void
Deletes a database of the given name in the given directory.
override