callNative function

void callNative(
  1. int engineId,
  2. Pointer<Utf16> moduleNamePtr,
  3. Pointer<Utf16> moduleFuncPtr,
  4. Pointer<Utf16> callIdPtr,
  5. Pointer<Void> paramsDataPtr,
  6. int paramsLen,
  7. int bridgeParamJsonInt,
)

Implementation

void callNative(
  int engineId,
  Pointer<Utf16> moduleNamePtr,
  Pointer<Utf16> moduleFuncPtr,
  Pointer<Utf16> callIdPtr,
  Pointer<Void> paramsDataPtr,
  int paramsLen,
  int bridgeParamJsonInt,
) {
  var bridgeParamJson = bridgeParamJsonInt == 1;
  var moduleName = moduleNamePtr.toDartString();
  var moduleFunc = moduleFuncPtr.toDartString();
  var callId = callIdPtr.toDartString();
  var dataList = paramsDataPtr.cast<Uint8>().asTypedList(paramsLen);

  final bridge = VoltronBridgeManager.bridgeMap[engineId];
  if (bridge != null) {
    bridge.callNatives(
      moduleName,
      moduleFunc,
      callId,
      dataList,
      bridgeParamJson,
    );
  }
}