event<T extends WorldEvent> method

Stream<Event<T>> event<T extends WorldEvent>()

Implementation

Stream<Event<T>> event<T extends WorldEvent>() {
  if (T == dynamic) {
    return _controller.stream as Stream<Event<T>>;
  }
  return _controller.stream
      .where((event) => event.clientEvent is T)
      .map((event) => event.castEvent<T>());
}