callFunction static method

Future callFunction(
  1. int engineId,
  2. String action,
  3. Object params,
  4. CommonCallback callback,
)

Implementation

static Future<dynamic> callFunction(
  int engineId,
  String action,
  Object params,
  CommonCallback callback,
) async {
  var stopwatch = Stopwatch();
  stopwatch.start();
  var actionPtr = action.toNativeUtf16();
  var paramsPair = _parseParams(params);
  stopwatch.stop();
  LogUtils.profile("callFunction", stopwatch.elapsedMilliseconds);
  _BridgeFFIManager.instance.callFunction(
    engineId,
    actionPtr,
    paramsPair.left,
    paramsPair.right.length,
    generateCallback((value) {
      stopwatch.stop();
      LogUtils.profile("callFunction", stopwatch.elapsedMilliseconds);
      callback(value);
    }),
  );
  free(actionPtr);
  free(paramsPair.left);
}