pagingRequestURL method

  1. @override
String pagingRequestURL(
  1. String url,
  2. int page
)
override

The url for a request using url and page to build.

Implementation

@override
String pagingRequestURL(String url, int page) {
  var uri = Uri.parse(url);

  var queryParameters =
      Map.from(uri.queryParametersAll).cast<String, dynamic>();

  var pageEntry = findKeyEntry(queryParameters, ['-PAGE', '--PAGE']);

  if (pageEntry != null) {
    queryParameters[pageEntry.key] = '$page';
  } else {
    queryParameters['--PAGE'] = '$page';
  }

  return Uri(
          scheme: uri.scheme,
          userInfo: uri.userInfo,
          host: uri.host,
          port: uri.port,
          path: uri.path,
          queryParameters: queryParameters)
      .toString();
}