getGroupMembersInfo static method

Future<V2TimValueCallback<List<V2TimGroupMemberFullInfo>>> getGroupMembersInfo({
  1. required String groupID,
  2. required List<String> memberList,
})

Implementation

static Future<V2TimValueCallback<List<V2TimGroupMemberFullInfo>>> getGroupMembersInfo({
  required String groupID,
  required List<String> memberList,
}) async {
  String param = json.encode({
    "group_get_members_info_list_param_group_id": groupID,
    "group_get_members_info_list_param_identifier_array": memberList,
  });
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_group_getmeminfos_param = Tools.string2PointerInt8(param);
  int res = desktopSDK.D_TIMGroupGetMemberInfoList(json_group_getmeminfos_param, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimGroupMemberFullInfo>>.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    Map<String, dynamic> nativeData = Map<String, dynamic>.from(json.decode(data["json_param"].isEmpty ? json.encode({}) : data["json_param"]));
    List<Map<String, dynamic>> dartList = List<Map<String, dynamic>>.from(nativeData["group_get_member_info_list_result_info_array"]);
    List<Map<String, dynamic>> memList = List.empty(growable: true);
    for (var element in dartList) {
      memList.add(Tools.memberInfo2DartFullInfo(element).toJson());
    }

    return V2TimValueCallback<List<V2TimGroupMemberFullInfo>>.fromJson({"code": data["code"], "desc": data["desc"], "data": memList});
  }
}