DatabaseDelegate class

An interface that supports sending database queries. Used as a backend for drift.

Database implementations should support the following types both for variables and result sets:





hashCode int
The hash code for this object.
isInTransaction bool
Whether the database managed by this delegate is in a transaction at the moment. This field is only set when the transactionDelegate is a NoTransactionDelegate, because in that case transactions are run on this delegate.
read / write
isOpen FutureOr<bool>
A future that completes with true when this database is open and with false when its not. The future may never complete with an error or with null. It should return relatively quickly, as drift queries it before each statement it sends to the database.
runtimeType Type
A representation of the runtime type of the object.
transactionDelegate TransactionDelegate
The way this database engine starts transactions.
versionDelegate DbVersionDelegate
Returns an appropriate class to resolve the current schema version in this database.


close() Future<void>
Closes this database. When the future completes, all resources used by this database should have been disposed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
notifyDatabaseOpened(OpeningDetails details) → void
Callback from drift after the database has been fully opened and all migrations ran.
open(QueryExecutorUser db) Future<void>
Opens the database. Drift will only call this when isOpen has returned false before. Further, drift will not attempt to open a database multiple times, so you don't have to worry about a connection being created multiple times.
runBatched(BatchedStatements statements) Future<void>
Runs multiple statements without having to prepare the same statement multiple times.
runCustom(String statement, List<Object?> args) Future<void>
Runs a custom statement with the given args. Ignores all results, but throws when the statement can't be executed.
runInsert(String statement, List<Object?> args) Future<int>
Prepares and executes the statement with the variables bound to args. The statement will be an INSERT statement.
runSelect(String statement, List<Object?> args) Future<QueryResult>
Prepares and executes the statement, binding the variables to args. Its safe to assume that the statement is a select statement, the QueryResult that it returns should be returned from here.
runUpdate(String statement, List<Object?> args) Future<int>
Prepares and executes the statement with the variables bound to args. The statement will either be an UPDATE or DELETE statement.
toString() String
A string representation of this object.


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