emit method

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

Trigger eventName event with or without the param given.

Implementation

void emit(
  Object? instance,
  Enum eventName, [
  dynamic param,
]) {
  final notifier = _getEventNotifier(instance, eventName);
  final notifierPartner = _getEventNotifierPartner(instance, eventName);

  if (eventName is Lifecycle) {
    _resolveLifecycleEvent(instance, eventName, param);
  }

  if (notifier?._dependencyRef == null) {
    notifier?.notifyListeners(param);
    notifierPartner?.notifyListeners(param);
    return;
  }

  notifierPartner?.notifyListeners(param);
  notifier?.notifyListeners(param);
}