fetchMemberListFromServer method Null safety
Gets the member list of the group with pagination.
For example:
EMCursorResult<String> result = await EMClient.getInstance.groupManager.fetchMemberListFromServer(groupId); // search 1
result = await EMClient.getInstance.groupManager.fetchMemberListFromServer(groupId, cursor: result.cursor); // search 2
Param groupId
The group ID.
Param pageSize
The number of group members per page.
Param cursor
The cursor position from which to start to get data next time. Sets the parameter as null for the first time.
Return The result of {@link EMCursorResult}, including the cursor for getting data next time and the group member list.
If EMCursorResult.cursor
is an empty string (""), all data is fetched.
Throws A description of the exception. See {@link EMError}.
Implementation
Future<EMCursorResult<String>> fetchMemberListFromServer(
String groupId, {
int pageSize = 200,
String? cursor,
}) async {
Map req = {
'groupId': groupId,
'pageSize': pageSize,
};
req.setValueWithOutNull("cursor", cursor);
Map result = await _channel.invokeMethod(
ChatMethodKeys.getGroupMemberListFromServer,
req,
);
try {
EMError.hasErrorFromResult(result);
return EMCursorResult<String>.fromJson(
result[ChatMethodKeys.getGroupMemberListFromServer],
dataItemCallback: (value) => value);
} on EMError catch (e) {
throw e;
}
}