commitToCurrentEngine static method

void commitToCurrentEngine({
  1. required String eventName,
  2. dynamic data,
})

Implementation

static void commitToCurrentEngine({required String eventName, dynamic data}) {
  var list = instance._listenerMap[eventName];
  if (list == null) return;
  int len = list.length - 1;
  //反向遍历,防止在订阅者在回调中移除自身带来的下标错位
  if (list.isNotEmpty) {
    for (var i = len; i > -1; --i) {
      MeteorEventBusListener listener = list[i].listener;
      listener.call(data);
    }
  }
}