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.
Source
Future<T> next() {
if (_queue.isEmpty) {
var c = new Completer<T>();
_completerQueue.add(c);
return c.future;
}
var val = _queue.removeAt(0);
return new Future.value(val);
}