getGroupsInfo static method

Future<V2TimValueCallback<List<V2TimGroupInfoResult>>> getGroupsInfo({
  1. required List<String> groupIDList,
})

Implementation

static Future<V2TimValueCallback<List<V2TimGroupInfoResult>>> getGroupsInfo({
  required List<String> groupIDList,
}) async {
  String param = json.encode(groupIDList);
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_group_getinfo_param = Tools.string2PointerInt8(param);
  int res = desktopSDK.D_TIMGroupGetGroupInfoList(json_group_getinfo_param, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimGroupInfoResult>>.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    List<Map<String, dynamic>> listData = List<Map<String, dynamic>>.from(json.decode(data["json_param"].isEmpty ? json.encode([]) : data["json_param"]));
    List<Map<String, dynamic>> dartListData = List<Map<String, dynamic>>.empty(growable: true);

    for (var element in listData) {
      Map<String, dynamic> nativeJson = Map<String, dynamic>.from(element);
      Map<String, dynamic> dartJson = Map<String, dynamic>.from(
        {
          "resultCode": nativeJson["get_groups_info_result_code"],
          "resultMessage": nativeJson["get_groups_info_result_desc"],
          "groupInfo": Tools.groupDetail2DartGroupInfo(nativeJson["get_groups_info_result_info"]).toJson(),
        },
      );
      dartListData.add(dartJson);
    }
    return V2TimValueCallback<List<V2TimGroupInfoResult>>.fromJson({"code": data["code"], "desc": data["desc"], "data": dartListData});
  }
}