notify method

Future<void> notify()

Removes an element from the wait queue and waits for the lock to be acquired.
After the locks acquired, schedules the action specified in the removed from the queue element to run.

Implementation

Future<void> notify() {
  if (_queue.isNotEmpty) {
    final awaiter = _queue.removeFirst();
    lock.acquire().then((_) {
      awaiter.complete(true);
    });
  }

  return _void;
}