writeTransaction<T> abstract method

Future<T> writeTransaction<T>(
  1. Future<T> callback(
    1. SqliteWriteContext tx
    ), {
  2. Duration? lockTimeout,
})

Open a read-write transaction.

This takes a global lock - only one write transaction can execute against the database at a time. This applies even when constructing separate SqliteDatabase instances for the same database file.

Statements within the transaction must be done on the provided SqliteWriteContext - attempting statements on the SqliteConnection instance will error.

Implementation

Future<T> writeTransaction<T>(
    Future<T> Function(SqliteWriteContext tx) callback,
    {Duration? lockTimeout});