next method Null safety
Returns an event that has been added to this server.
This method will return the first element in the first-in-first-out queue of events that have been added to this instance. If no events are available, this Future will complete when the next event is added.
Implementation
Future<T> next() {
if (_queue.isEmpty) {
final c = Completer<T>();
_completerQueue.add(c);
return c.future;
}
return Future.value(_queue.removeAt(0));
}