next method
This method lets you get the next page of models. If there is no next page, it will throw a NoNextPageException. If you want to check if there is a next page before calling this method, use hasNextPage.
final paginatedModels = await ReplicateModels().listModels();
if (paginatedModels.hasNextPage) {
final nextPage = await paginatedModels.next();
print(nextPage.results);
}
Implementation
Future<PaginatedModels> next() async {
if (!hasNextPage) {
throw NoNextPageException();
}
assert(nextApiUrl != null, "No next page exists for this list");
return await ReplicateModels().listModelsFromApiLink(nextApiUrl!);
}