readLock<T> method
Future<T>
readLock<T>(})
override
Takes a read lock, without starting a transaction.
The lock only applies to a single SqliteConnection, and multiple connections may hold read locks at the same time.
In most cases, readTransaction should be used instead.
Implementation
@override
Future<T> readLock<T>(Future<T> Function(SqliteReadContext tx) callback,
{Duration? lockTimeout, String? debugContext}) {
final task = profileQueries ? TimelineTask() : null;
task?.start('${profilerPrefix}mutex_lock');
return mutex.lock(
() {
task?.finish();
return callback(SyncReadContext(db, parent: task));
},
timeout: lockTimeout,
);
}