initBridge static method
void
initBridge()
Implementation
static void initBridge() {
// 注册callNative回调
var callNativeRegisterFunc = FfiManager()
.library
.lookupFunction<AddCallFuncNativeType<CallNativeFfi>, AddCallFuncDartType<CallNativeFfi>>(
FfiManager().registerFuncName,
);
var callNativeFunc = Pointer.fromFunction<CallNativeFfi>(callNative);
FfiManager().addRegisterFunc(
_BridgeFFIManager._kVoltronCoreRegisterHeader,
LoaderFuncType.callNative.index,
callNativeFunc,
callNativeRegisterFunc,
);
// 注册reportJsonException回调
var reportJsonExceptionRegisterFunc = FfiManager().library.lookupFunction<
AddCallFuncNativeType<ReportJsonException>, AddCallFuncDartType<ReportJsonException>>(
FfiManager().registerFuncName,
);
var reportJsonExceptionFunc = Pointer.fromFunction<ReportJsonException>(reportJsonException);
FfiManager().addRegisterFunc(
_BridgeFFIManager._kVoltronCoreRegisterHeader,
LoaderFuncType.reportJsonException.index,
reportJsonExceptionFunc,
reportJsonExceptionRegisterFunc,
);
// 注册reportJSException回调
var reportJsExceptionRegisterFunc = FfiManager().library.lookupFunction<
AddCallFuncNativeType<ReportJsException>, AddCallFuncDartType<ReportJsException>>(
FfiManager().registerFuncName,
);
var reportJSExceptionFunc = Pointer.fromFunction<ReportJsException>(reportJSException);
FfiManager().addRegisterFunc(
_BridgeFFIManager._kVoltronCoreRegisterHeader,
LoaderFuncType.reportJsException.index,
reportJSExceptionFunc,
reportJsExceptionRegisterFunc,
);
}