getUsersInfo static method

Future<V2TimValueCallback<List<V2TimUserFullInfo>>> getUsersInfo({
  1. required List<String> userIDList,
})

Implementation

static Future<V2TimValueCallback<List<V2TimUserFullInfo>>> getUsersInfo({
  required List<String> userIDList,
}) async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Map<String, dynamic> param = Map.from({
    "friendship_getprofilelist_param_identifier_array": userIDList,
    "friendship_getprofilelist_param_force_update": false,
  });
  Pointer<Uint8> paramPtr = Tools.string2PointerInt8(json.encode(param));
  int res = desktopSDK.D_TIMProfileGetUserProfileList(paramPtr, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimUserFullInfo>>.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;
      V2TimUserFullInfo converInfo = Tools.userProfile2DartUserFullInfo(jso);
      list.add(converInfo.toJson());
    }
    return V2TimValueCallback<List<V2TimUserFullInfo>>.fromJson({
      "code": res,
      "desc": "",
      "data": list,
    });
  }
}