fromJson<T> static method

  1. @visibleForTesting
PageableItemList<T>? fromJson<T>(
  1. dynamic jsonObject,
  2. T? fromJSON(
    1. dynamic
    )
)

Implementation

@visibleForTesting
static PageableItemList<T>? fromJson<T>(
  jsonObject,
  T? Function(dynamic) fromJSON,
) {
  if (jsonObject == null) return null;
  var result = PageableItemList<T>._privateConstructor();

  if (jsonObject["items"] != null) {
    result._items = [];
    for (var item in jsonObject["items"]) {
      var temp = fromJSON(item);
      if (temp != null) result._items!.add(temp);
    }
  }
  result._page = jsonObject["page"];
  result._totalPages = jsonObject["totalPages"];

  return result;
}