PaginatedModels.fromJson constructor

PaginatedModels.fromJson(
  1. Map<String, dynamic> json
)

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(),
  );
}