DataPage<T>.fromJson constructor

DataPage<T>.fromJson(
  1. Map<String, dynamic> json,
  2. Function fromJson
)

Creates a new instance of data page and assigns its values.

  • json json values to initialize this object.
  • fromJson convert function for convert from json into

Implementation

factory DataPage.fromJson(Map<String, dynamic> json, Function fromJson) {
  //final items = json['data'].cast<Map<String, dynamic>>();
  final items = json['data'];

  return DataPage<T>(
      List<T>.from(items.map((itemsJson) => fromJson(itemsJson))),
      json['total']);
}