writeTransaction<T> method
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
@override
Future<T> writeTransaction<T>(
Future<T> Function(SqliteWriteContext tx) callback,
{Duration? lockTimeout}) async {
return writeLock((ctx) async {
return await internalWriteTransaction(ctx, callback);
}, lockTimeout: lockTimeout, debugContext: 'writeTransaction()');
}