withWrite<T> method

Future<T> withWrite<T>(
  1. String table,
  2. Future<T> fn(), {
  3. int timeoutMs = 5000,
})

Implementation

Future<T> withWrite<T>(String table, Future<T> Function() fn,
    {int timeoutMs = 5000}) async {
  final g = await acquireWrite(table, timeoutMs: timeoutMs);
  try {
    return await fn();
  } finally {
    release(g);
  }
}