write<T> method

Future<T> write<T>(
  1. Future<T> action()
)

Runs action under the exclusive write lock, releasing it afterward even if action throws. No reads or other writes overlap it. Audited: 2026-06-12 11:26 EDT

Implementation

Future<T> write<T>(Future<T> Function() action) async {
  await _acquireWrite();
  try {
    return await action();
  } finally {
    _releaseWrite();
  }
}