PaginatedModels.fromJson constructor
This method lets you get a paginated list of models, with the ability to fetch the next and previous pages if they exist.
Implementation
factory PaginatedModels.fromJson(Map<String, dynamic> json) {
return PaginatedModels(
previousApiUrl: json['previous'],
nextApiUrl: json['next'],
results: (json['results'] as List)
.map((e) => PaginationModel.fromJson(e))
.toList(),
);
}