callExperimentalAPI static method

Future<V2TimValueCallback<Object>> callExperimentalAPI({
  1. required String api,
  2. Object? param,
})

Implementation

static Future<V2TimValueCallback<Object>> callExperimentalAPI({
  required String api,
  Object? param,
}) async {
  if (api == "setLocalConfigPath") {
    if (param != null) {
      localConfigPath = param as String;
      return V2TimValueCallback<Object>.fromJson({"code": 0, "desc": "OK", "data": ""});
    }
  }
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  // TODO 这里要做一下其他实验性接口的是适配,目前仅支持设置ui_platform
  Pointer<Uint8> json_param = Tools.string2PointerInt8(json.encode(Map.from({"request_internal_operation": api, "request_set_ui_platform_param": param})));
  int res = desktopSDK.D_callExperimentalAPI(json_param, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<Object>.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    return V2TimValueCallback<Object>.fromJson({"code": data["code"], "desc": data["desc"], "data": data["json_param"]});
  }
}