nextPage method

Future<PcoCollection<T>> nextPage()

nextPage will return a new collection representing the next page of data from the server. The page offset is stored in the metadata of the previous response. If the server has no more items, the API will be called with an offset equal to the total count of items as reported by the server on the previous request.

You should not call this function unless you first check hasMore or you expect new resources have been added on the server. Otherwise it might be a wasted request.

Implementation

Future<PcoCollection<T>> nextPage() {
  return PcoCollection.fromApiCall<T>(
    endpoint,
    query: query.withOffset(meta.nextOffset ?? meta.totalCount),
    apiVersion: apiVersion,
  );
}