on method

dynamic on(
  1. dynamic event,
  2. Function listener
)

Add a listener to be triggered for each event.

Implementation

on(dynamic event, Function listener) {
  assert(event is String || event is _EventFilterImpl,
      'Event type must be valid.');
  return callMethod(impl, 'on', [
    event is EventFilter ? event.impl : event,
    allowInterop(listener),
  ]);
}