setGroupAttributes static method
Implementation
static Future<V2TimCallback> setGroupAttributes({
required String groupID,
required Map<String, String> attributes,
}) async {
List<Map<String, dynamic>> arr = List.empty(growable: true);
if (attributes.isNotEmpty) {
attributes.forEach((key, value) {
arr.add({
"group_attribute_key": key,
"group_attribute_value": value,
});
});
}
String userData = Tools.generateUserData();
Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
Pointer<Uint8> json_group_atrributes = Tools.string2PointerInt8(json.encode(arr));
Pointer<Uint8> group_id = Tools.string2PointerInt8(groupID);
int res = desktopSDK.D_TIMGroupSetGroupAttributes(group_id, json_group_atrributes, user_data);
if (res != TIMResult.TIM_SUCC) {
return V2TimCallback.fromJson({
"code": res,
"desc": "",
});
} else {
Map<String, dynamic> data = await getAsyncData(apiKey: userData);
return V2TimCallback.fromJson({
"code": data["code"],
"desc": data["desc"],
});
}
}