registerWith static method

void registerWith(
  1. Registrar registrar
)

Implementation

static void registerWith(Registrar registrar) {
  final MethodChannel channel = MethodChannel(
    'plugins.zego.im/zego_express_engine',
    const StandardMethodCodec(),
    registrar,
  );

  // ignore: unused_local_variable
  final eventChannel = PluginEventChannel(
      'plugins.zego.im/zego_express_event_handler',
      const StandardMethodCodec(),
      registrar);

  final pluginInstance = ZegoExpressEngineWeb();
  channel.setMethodCallHandler(pluginInstance.handleMethodCall);
  eventChannel.setController(ZegoExpressEngineWeb._evenController);

  _evenController.stream.listen((event) {
    _eventListener(event);
  });

  var element = ScriptElement()
    ..src =
        'assets/packages/zego_express_engine/assets/ZegoExpressWebFlutterWrapper.js'
    ..type = 'application/javascript';
  document.body!.append(element);
}