Database class Null safety Database
A Couchbase Lite database.
- Implemented types
- Implementers
Constructors
- Database()
Properties
- config → DatabaseConfiguration
-
The configuration which was used to open this database.
read-only
-
count
→ FutureOr<
int> -
The total number of documents in the database.
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
-
indexes
→ FutureOr<
List< String> > -
The names of all existing indexes.
read-only
- isClosed → bool
-
Whether this resource has been closed.
read-only, inherited
- name → String
-
The name of this database.
read-only
- path → String?
-
The path to this database. [...]
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
addChangeListener(
DatabaseChangeListener listener) → FutureOr< ListenerToken> -
Adds a
listener
to be notified of all changes to Documents in this database. [...] -
addDocumentChangeListener(
String id, DocumentChangeListener listener) → FutureOr< ListenerToken> -
Adds a
listener
to be notified of changes to the Document with the givenid
. [...] -
changeEncryptionKey(
EncryptionKey? newKey) → FutureOr< void> - Encrypts or decrypts a Database, or changes its EncryptionKey. [...]
-
changes(
) → Stream< DatabaseChange> - Returns a Stream to be notified of all changes to Documents in this database. [...]
-
close(
) → Future< void> -
Closes this database. [...]
override
-
createIndex(
String name, Index index) → FutureOr< void> -
Creates a value or full-text search
index
with the givenname
. [...] -
delete(
) → Future< void> - Closes and deletes this database. [...]
-
deleteDocument(
Document document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) → FutureOr< bool> -
Deletes a
document
from this database, resolving conflicts through ConcurrencyControl. [...] -
deleteIndex(
String name) → FutureOr< void> -
Deletes the Index of the given
name
. -
document(
String id) → FutureOr< Document?> -
Returns the
Document
with the givenid
, if it exists. -
documentChanges(
String id) → Stream< DocumentChange> -
Returns a Stream to be notified of changes to the Document with the
given
id
. [...] -
getDocumentExpiration(
String id) → FutureOr< DateTime?> -
Gets the expiration date of a Document by its
id
, if it exists. -
inBatch(
FutureOr< void> fn()) → FutureOr<void> - Runs a group of database operations in a batch. [...]
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
performMaintenance(
MaintenanceType type) → FutureOr< void> - Performs database maintenance.
-
purgeDocument(
Document document) → FutureOr< void> -
Purges a
document
from this database. [...] -
purgeDocumentById(
String id) → FutureOr< void> -
Purges a Document from this database by its
id
. [...] -
removeChangeListener(
ListenerToken token) → FutureOr< void> - Removes a previously added change listener. [...]
-
saveDocument(
MutableDocument document, [ConcurrencyControl concurrencyControl = ConcurrencyControl.lastWriteWins]) → FutureOr< bool> -
Saves a
document
to this database, resolving conflicts through ConcurrencyControl. [...] -
saveDocumentWithConflictHandler(
MutableDocument document, SaveConflictHandler conflictHandler) → FutureOr< bool> -
Saves a
document
to this database, resolving conflicts with aconflictHandler
. [...] -
setDocumentExpiration(
String id, DateTime? expiration) → FutureOr< void> -
Sets an
expiration
date for a Document by itsid
. [...] -
toString(
) → String -
A string representation of this object. [...]
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
-
operator [](
String id) → FutureOr< DocumentFragment> -
Returns the
DocumentFragment
for the Document with the givenid
.
Static Properties
- log → Log
-
Configuration of the ConsoleLogger, FileLogger and a custom Logger.
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 givenname
andconfig
. [...] -
copySync(
{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
. [...] -
exists(
String name, {String? directory}) → Future< bool> -
Checks whether a database of the given
name
exists in the givendirectory
or not. -
existsSync(
String name, {String? directory}) → bool -
Checks whether a database of the given
name
exists in the givendirectory
or not. -
openAsync(
String name, [DatabaseConfiguration? config]) → Future< AsyncDatabase> -
Opens a Couchbase Lite database with the given
name
andconfig
, which executes in a separate worker isolate. [...] -
openSync(
String name, [DatabaseConfiguration? config]) → SyncDatabase -
Opens a Couchbase Lite database with the given
name
andconfig
, which executes in the current isolate. [...] -
remove(
String name, {String? directory}) → Future< void> -
Deletes a database of the given
name
in the givendirectory
. -
removeSync(
String name, {String? directory}) → void -
Deletes a database of the given
name
in the givendirectory
.