getTopicInfoList static method

Future<V2TimValueCallback<List<V2TimTopicInfoResult>>> getTopicInfoList({
  1. required String groupID,
  2. required List<String> topicIDList,
})

Implementation

static Future<V2TimValueCallback<List<V2TimTopicInfoResult>>> getTopicInfoList({
  required String groupID,
  required List<String> topicIDList,
}) async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_topic_id_array = Tools.string2PointerInt8(json.encode(topicIDList));
  Pointer<Uint8> group_id = Tools.string2PointerInt8(groupID);
  int res = desktopSDK.D_TIMGroupGetTopicInfoList(group_id, json_topic_id_array, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimTopicInfoResult>>.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    List<Map<String, dynamic>> dataList = List<Map<String, dynamic>>.from(json.decode(data["json_param"].isEmpty ? json.encode([]) : data["json_param"]));
    List<Map<String, dynamic>> list = List<Map<String, dynamic>>.empty(growable: true);
    for (var element in dataList) {
      Map<String, dynamic> jso = element;
      list.add(Map<String, dynamic>.from({
        "errorCode": jso["group_topic_info_result_error_code"],
        "errorMessage": jso["group_topic_info_result_error_message"],
        "topicInfo": (await Tools.convert2DartTopicInfo(jso["group_topic_info_result_topic_info"])).toJson(),
      }));
    }
    return V2TimValueCallback<List<V2TimTopicInfoResult>>.fromJson({
      "code": data['code'],
      "desc": data['desc'],
      "data": list,
    });
  }
}