fromJson static method

Menu fromJson(
  1. dynamic value
)
override

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

Implementation

// ignore: prefer_constructors_over_static_methods
static Menu fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return Menu(
      data: MenuData.fromJson(json[r'data']),
      links: Links.mapFromJson(json[r'links']),
      meta: ComponentMeta.fromJson(json[r'meta']),
      type: ElementTypeEnum.fromJson(json[r'type']),
    );
  }
  throw Exception('menu value is not a map');
}