wait method

Future<void> wait()

Blocks the calling code until the event switches the signaled state.
If the event is already in the signaled state, the calling code continues execution, and the event is immediately switched to the non-signaled state.

Implementation

Future<void> wait() {
  if (_isSet) {
    _isSet = false;
    return _ResetEvent._void;
  } else {
    return _queue.enqueue();
  }
}