wait method

Future<void> wait()

Releases the lock and waits for a notification.
Upon receiving the notification, the lock will be reacquired. Accordingly, upon exiting the method, the locked code will be entered.

Implementation

Future<void> wait() async {
  await lock.release();
  await _queue.enqueue();
}