emit method

void emit(
  1. Object? instance,
  2. Enum eventName, [
  3. dynamic param
])

Trigger eventName event with or without the param given.

Implementation

void emit(
  Object? instance,
  Enum eventName, [
  dynamic param,
]) {
  final callbacks = {
    ...?_events[_getEventKey(instance, eventName)],
    ...?_events["${instance.hashCode}.${eventName.hashCode}"],
  };

  for (var callback in callbacks) {
    callback(_getInstance(instance), param);
  }
}