fromJson static method

Pagination fromJson(
  1. dynamic value
)
override

Returns a new Pagination instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static Pagination fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return Pagination(
      items: Pointer.listFromJson(json[r'items']),
      offset: mapValueOfType<int>(json, r'offset'),
      total: mapValueOfType<int>(json, r'total'),
      size: mapValueOfType<int>(json, r'size'),
      first: PaginationPage.fromJson(json[r'first']),
      current: PaginationPage.fromJson(json[r'current']),
      previous: PaginationPage.fromJson(json[r'previous']),
      next: PaginationPage.fromJson(json[r'next']),
      last: PaginationPage.fromJson(json[r'last']),
      pages: PaginationPage.listFromJson(json[r'pages']),
      enabled: mapValueOfType<bool>(json, r'enabled'),
      links: Links.mapFromJson(json[r'links']),
      meta: ComponentMeta.fromJson(json[r'meta']),
      type: ElementTypeEnum.fromJson(json[r'type']),
    );
  }
  throw new Exception("pagination data is not a map");
}