fetchMemberListFromServer method

Future<ChatCursorResult<String>> fetchMemberListFromServer(
  1. String groupId, {
  2. int pageSize = 200,
  3. String? cursor,
})

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 ChatError.

Implementation

Future<ChatCursorResult<String>> fetchMemberListFromServer(
  String groupId, {
  int pageSize = 200,
  String? cursor,
}) async {
  try {
    Map req = {
      'groupId': groupId,
      'pageSize': pageSize,
    };
    req.putIfNotNull("cursor", cursor);
    Map result = await platform_interface.Client.instance.groupManager.callNativeMethod(
      ChatMethodKeys.getGroupMemberListFromServer,
      req,
    );
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<String>.fromJson(
        result[ChatMethodKeys.getGroupMemberListFromServer],
        dataItemCallback: (value) => value);
  } catch (e) {
    rethrow;
  }
}