writeLock<T> method

  1. @override
Future<T> writeLock<T>(
  1. Future<T> callback(
    1. SqliteWriteContext tx
    ), {
  2. Duration? lockTimeout,
  3. String? debugContext,
})
override

Takes a global lock, without starting a transaction.

In most cases, writeTransaction should be used instead.

The lock applies to all SqliteConnection instances for a SqliteDatabase. Locks for separate SqliteDatabase instances on the same database file may be held concurrently.

Implementation

@override
Future<T> writeLock<T>(Future<T> Function(SqliteWriteContext tx) callback,
    {Duration? lockTimeout, String? debugContext}) {
  return mutex.lock(() => callback(SyncWriteContext(db)),
      timeout: lockTimeout);
}