write method

Future write()

Acquire a write lock

Returns a future that will be completed when the lock has been acquired.

A write lock can only be acquired when there are no other locks (neither read locks nor write locks) on the mutex.

Consider using the convenience method withWriteLock, otherwise the caller is responsible for making sure the lock is released after it is no longer needed. Failure to release the lock means no other code can acquire the lock (neither a read lock or a write lock).

Implementation

Future write() => _acquire(isRead: false);