emit method

void emit(
  1. String event, [
  2. Object? data
])
inherited

emit will always emit twice... first, by the name of the event submitted, and secondly, by the name of the special event 'all'

Implementation

void emit(String event, [T? data]) {
  for (var name in [event, 'all']) {
    var e = Event(name, data);
    eventStream.add(e);
    if (callbacks.containsKey(name)) {
      for (var callback in callbacks[name]!) {
        callback(e);
      }
    }
  }
}