transferGroupOwner static method

Future<V2TimCallback> transferGroupOwner({
  1. required String groupID,
  2. required String userID,
})

Implementation

static Future<V2TimCallback> transferGroupOwner({
  required String groupID,
  required String userID,
}) async {
  int flag = 0x00;

  Map<String, dynamic> param = Map<String, dynamic>.from({
    "group_modify_info_param_group_id": groupID,
  });

  flag = flag | 0x01 << 31;
  param["group_modify_info_param_owner"] = userID;

  param["group_modify_info_param_modify_flag"] = flag;

  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_group_modifyinfo_param = Tools.string2PointerInt8(json.encode(param));
  int res = desktopSDK.D_TIMGroupModifyGroupInfo(json_group_modifyinfo_param, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimCallback.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    return V2TimCallback.fromJson({
      "code": data["code"],
      "desc": data["desc"],
    });
  }
}