respond<T> method

Subscription respond<T>(
  1. Responder<T> responder
)

Register a responder to event bus for the event type T. If T is omitted or given as dynamic, it listens to all events that published on EventBus.

Method call can be safely chained, and the order doesn't matter.

eventBus
  .respond<EventA>(responderA)
  .respond<EventB>(responderB);

Implementation

Subscription respond<T>(Responder<T> responder) {
  subscriptions.add(_cast<T>().listen(responder));
  return this;
}