You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
485B

  1. class PagedResult<T> {
  2. final int totalElements;
  3. final List<T> results;
  4. PagedResult({this.totalElements, this.results});
  5. factory PagedResult.fromJson(Map<String, dynamic> json, object) {
  6. final items = json['content'].cast<Map<String, dynamic>>();
  7. final listItems =
  8. new List<T>.from(items.map((itemsJson) => object.fromJson(itemsJson)));
  9. final total = json['totalElements'] as num;
  10. return PagedResult<T>(totalElements: total, results: listItems);
  11. }
  12. }