buildGetNextPageParameters method

  1. @override
ListBatches buildGetNextPageParameters(
  1. List<Batch>? currentPageItems,
  2. {int? pageSize}
)

Builds the ListParametersType-type parameter set to use to retrieve the next page of a PaginatedCollection. This method should be overridden by subclasses to provide the appropriate parameters for the next page request.

Implementation

@override
ListBatches buildGetNextPageParameters(List<Batch>? currentPageItems,
    {int? pageSize}) {
  ListBatches parameters = filters ?? ListBatches();

  // Batches get returned in reverse order from everything else (oldest first instead of newest first), so this needs to be "after_id" instead of "before_id"
  parameters.afterId = currentPageItems?.last.id;

  if (pageSize != null) {
    parameters.pageSize = pageSize;
  }

  return parameters;
}