emit method

void emit(
  1. String event, [
  2. dynamic data
])

Emits an event, calling all registered listeners.

Implementation

void emit(String event, [dynamic data]) {
  for (var listener in _listeners[event] ?? []) {
    listener(data);
  }
}