dispatch<T extends FastModuleProtocol> method

dynamic dispatch<T extends FastModuleProtocol>({
  1. String? moduleName,
  2. required String eventName,
  3. dynamic arguments,
})

Implementation

dynamic dispatch<T extends FastModuleProtocol>(
    {String? moduleName, required String eventName, dynamic arguments}) {
  if (eventName.isEmpty) return;
  var key = T.toString();
  if (moduleName != null && moduleName.isNotEmpty) {
    key = moduleName;
  }
  if (_modules[key] == null) {
    fastPrintWaring('$key组件未注册, 请先调用register,在发送消息', name: 'FAST_MODULE_WARNING');
  }
  return _modules[key]?.onReceivedMessage(eventName, arguments);
}