initBridge static method

void initBridge()

Implementation

static void initBridge() async {
  // 添加postRenderOp回调
  var postRenderRegisterFunc = FfiManager().library.lookupFunction<
      AddCallFuncNativeType<PostRenderOpNativeType>,
      AddCallFuncDartType<PostRenderOpNativeType>>(FfiManager().registerFuncName);

  var postRenderOpFunc = Pointer.fromFunction<PostRenderOpNativeType>(postRenderOp);
  FfiManager().addRegisterFunc(
    _RenderBridgeFFIManager._kRenderRegisterHeader,
    RenderFuncType.postRenderOp.index,
    postRenderOpFunc,
    postRenderRegisterFunc,
  );

  // 添加layout回调
  var calculateNodeLayoutRegisterFunc = FfiManager().library.lookupFunction<
      AddCallFuncNativeType<CalculateNodeLayoutNativeType>,
      AddCallFuncDartType<CalculateNodeLayoutNativeType>>(FfiManager().registerFuncName);
  var calculateNodeLayoutFunc =
      Pointer.fromFunction<CalculateNodeLayoutNativeType>(calculateNodeLayout);
  FfiManager().addRegisterFunc(
    _RenderBridgeFFIManager._kRenderRegisterHeader,
    RenderFuncType.calculateNodeLayout.index,
    calculateNodeLayoutFunc,
    calculateNodeLayoutRegisterFunc,
  );
}