fetchMemberListFromServer method
~english Gets the list of group members from the server with pagination.
Param groupId The group ID.
Param pageSize The number of members expected to be returned per page.
Param cursor The cursor for pagination, pass null for the first call.
Returns The member list and cursor for next page.
Throws Exception description, see EMError. ~end
~chinese 从服务器获取群组成员列表(分页获取)。
Param groupId 群组 ID。
Param pageSize 每页期望返回的成员数量。
Param cursor 分页游标,首次调用传空。
Return 成员列表和下一页游标。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError. ~end
Implementation
Future<EMCursorResult<String>> fetchMemberListFromServer(
String groupId, {
int pageSize = 200,
String? cursor,
}) async {
try {
Map req = {
'groupId': groupId,
'pageSize': pageSize,
};
req.putIfNotNull("cursor", cursor);
Map result = await Client.instance.groupManager.callNativeMethod(
ChatMethodKeys.getGroupMemberListFromServer,
req,
);
EMError.hasErrorFromResult(result);
return EMCursorResult<String>.fromJson(
result[ChatMethodKeys.getGroupMemberListFromServer],
dataItemCallback: (value) => value);
} catch (e) {
rethrow;
}
}