registerBridgeChannelMethods function

void registerBridgeChannelMethods()

注册渲染相关 channel 方法

Implementation

void registerBridgeChannelMethods () {
  DynamicChannel.register({
    'bridgeRequest': (params) async {
      String methodId = Util.getString(params['methodId']);
      Map<String, dynamic> request = jsonDecode(params['request']);
      Map<String, dynamic> res = await Util.request(request['params']);
      dynamicApp?.call(
        method: ChannelMethod.bridgeResponse,
        params: {
          'methodId': methodId,
          'response': res
        }
      );
    },
  });
}