on method

void on(
  1. String event,
  2. dynamic listener(
    1. dynamic
    )
)

Adds a listener for a specific event.

Implementation

void on(String event, Function(dynamic) listener) {
  _listeners.putIfAbsent(event, () => []).add(listener);
}