SyncDatabase class Null safety 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
andconfig
, which executes in the current isolate. [...]factory
Properties
- config → DatabaseConfiguration
-
The configuration which was used to open this database.
read-only, inherited
- count → int
-
The total number of documents in the database.
read-only, override
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
-
indexes
→ 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) → 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 givenid
. [...]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 givenname
. [...]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 -
document(
String id) → Document? -
Returns the
Document
with the givenid
, 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 -
getDocumentExpiration(
String id) → DateTime? -
Gets the expiration date of a Document by its
id
, if it exists.override -
inBatch(
FutureOr< void> fn()) → FutureOr<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 non-existent 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 -
removeChangeListener(
ListenerToken token) → void -
Removes a previously added change listener. [...]
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 aconflictHandler
. [...]inherited -
saveDocumentWithConflictHandlerSync(
MutableDocument document, SyncSaveConflictHandler conflictHandler) → bool -
Saves a
document
to this database, resolving conflicts with an syncconflictHandler
. [...] -
setDocumentExpiration(
String id, DateTime? expiration) → void -
Sets an
expiration
date for a Document by itsid
. [...]override -
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
-
operator [](
String id) → DocumentFragment -
Returns the
DocumentFragment
for the Document with the givenid
.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 givenname
andconfig
. [...]override -
exists(
String name, {String? directory}) → bool -
Checks whether a database of the given
name
exists in the givendirectory
or not.override -
remove(
String name, {String? directory}) → void -
Deletes a database of the given
name
in the givendirectory
.override