getNextPage method

Future<Page<T>?> getNextPage(
  1. Client httpClient
)

The next page of results or null when there is no link for the next page of results

Implementation

Future<Page<T>?> getNextPage(http.Client httpClient) async {
  if (this.links!.next == null) {
    return null;
  }
  checkNotNull(
      this.type,
      "type cannot be null, is it being correctly set after the creation of this " +
          this.runtimeType.toString() +
          "?");
  ResponseHandler<Page<T>> responseHandler = ResponseHandler<Page<T>>(this.type);
  String? url = this.links!.next!.href;

  return await httpClient.get(Uri.parse(url), headers: RequestBuilder.headers).then((response) {
    return responseHandler.handleResponse(response);
  });
}