getJoinedCommunityList static method
Future<V2TimValueCallback<List<V2TimGroupInfo>>>
getJoinedCommunityList(
)
Implementation
static Future<V2TimValueCallback<List<V2TimGroupInfo>>> getJoinedCommunityList() async {
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
int res = desktopSDK.D_TIMGroupGetJoinedCommunityList(user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimValueCallback<List<V2TimGroupInfo>>.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>> dartListData = List<Map<String, dynamic>>.empty(growable: true);
for (var element in dataList) {
Map<String, dynamic> nativeJson = Map<String, dynamic>.from(element);
Map<String, dynamic> dartJson = Tools.groupDetail2DartGroupInfo(nativeJson).toJson();
dartListData.add(dartJson);
}
return V2TimValueCallback<List<V2TimGroupInfo>>.fromJson({"code": data["code"], "desc": data["desc"], "data": dartListData});
// Map<String, dynamic> data = await getAsyncData(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) {
// list.add((await Tools.convert2DartTopicInfo(element)).toJson());
// }
// return V2TimValueCallback<List<V2TimGroupInfo>>.fromJson({
// "code": data['code'],
// "desc": data['desc'],
// "data": list,
// });
}
}