WebSqliteConnection class abstract

A SqliteConnection interface implemented by opened connections when running on the web.

This adds the exposeEndpoint, which uses dart:js_interop types not supported on native Dart platforms. The method can be used to access an opened database across different JavaScript contexts (e.g. document windows and workers).

Implemented types

Constructors

WebSqliteConnection()

Properties

closed bool
Returns true if the connection is closed
no setterinherited
closedFuture Future<void>
Returns a future that completes when this connection is closed.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
updates Stream<UpdateNotification>?
Reports table change update notifications
no setterinherited

Methods

close() Future<void>
inherited
computeWithDatabase<T>(Future<T> compute(CommonDatabase db)) Future<T>
Run a function within a database isolate, with direct synchronous access to the underlying database.
inherited
execute(String sql, [List<Object?> parameters = const []]) Future<ResultSet>
Execute a write query (INSERT, UPDATE, DELETE) and return the results (if any).
inherited
executeBatch(String sql, List<List<Object?>> parameterSets) Future<void>
Execute a write query (INSERT, UPDATE, DELETE) multiple times with each parameter set. This is faster than executing separately with each parameter set.
inherited
exposeEndpoint() Future<WebDatabaseEndpoint>
Returns a WebDatabaseEndpoint - a structure that consists only of types that can be transferred across a MessagePort in JavaScript.
flush() Future<void>
Flush changes to the underlying storage.
get(String sql, [List<Object?> parameters = const []]) Future<Row>
Execute a read-only (SELECT) query and return a single result.
inherited
getAll(String sql, [List<Object?> parameters = const []]) Future<ResultSet>
Execute a read-only (SELECT) query and return the results.
inherited
getAutoCommit() Future<bool>
Returns true if auto-commit is enabled. This means the database is not currently in a transaction. This may be true even if a transaction lock is still held, when the transaction has been committed or rolled back.
inherited
getOptional(String sql, [List<Object?> parameters = const []]) Future<Row?>
Execute a read-only (SELECT) query and return a single optional result.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
readLock<T>(Future<T> callback(SqliteReadContext tx), {Duration? lockTimeout, String? debugContext}) Future<T>
Takes a read lock, without starting a transaction.
inherited
readTransaction<T>(Future<T> callback(SqliteReadContext tx), {Duration? lockTimeout}) Future<T>
Open a read-only transaction.
inherited
refreshSchema() Future<void>
Ensures that all connections are aware of the latest schema changes applied (if any). Queries and watch calls can potentially use outdated schema information after a schema update.
inherited
toString() String
A string representation of this object.
inherited
watch(String sql, {List<Object?> parameters = const [], Duration throttle = const Duration(milliseconds: 30)}) Stream<ResultSet>
Execute a read query every time the source tables are modified.
inherited
writeLock<T>(Future<T> callback(SqliteWriteContext tx), {Duration? lockTimeout, String? debugContext, bool? flush}) Future<T>
Same as SqliteConnection.writeLock.
override
writeTransaction<T>(Future<T> callback(SqliteWriteContext tx), {Duration? lockTimeout, bool? flush}) Future<T>
Same as SqliteConnection.writeTransaction.
override

Operators

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

Static Methods

connectToEndpoint(WebDatabaseEndpoint endpoint) Future<WebSqliteConnection>
Connect to an endpoint obtained through exposeEndpoint.