fetchMemberAttributes method
Gets all custom attributes of a group member.
Param groupId
The group ID.
Param userId
The user ID of the group member whose all custom attributes are retrieved. The default value is the current user ID.
Return The user attributes of the group member.
Throws A description of the exception. See ChatError.
Implementation
Future<Map<String, String>> fetchMemberAttributes({
required String groupId,
String? userId,
}) async {
Map req = {'groupId': groupId};
if (userId != null) {
req.putIfNotNull('userId', userId);
}
Map result = await _channel.invokeMethod(
ChatMethodKeys.fetchMemberAttributesFromGroup, req);
try {
ChatError.hasErrorFromResult(result);
Map<String, String> ret = {};
result[ChatMethodKeys.fetchMemberAttributesFromGroup]
.forEach((key, value) {
ret[key] = value;
});
return ret;
} on ChatError catch (e) {
throw e;
}
}