fromJson static method

MenuItem fromJson(
  1. dynamic value
)

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

Implementation

// ignore: prefer_constructors_over_static_methods
static MenuItem fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return MenuItem(
        depth: mapValueOfType<int>(json, r'depth'),
        repositoryBased: mapValueOfType<bool>(json, r'repositoryBased'),
        properties: mapCastOfType<String, String>(json, r'properties'),
        name: mapValueOfType<String>(json, r'name'),
        childMenuItems: MenuItem.listFromJson(json[r'childMenuItems']),
        expanded: mapValueOfType<bool>(json, r'expanded'),
        selected: mapValueOfType<bool>(json, r'selected'),
        parameters: mapCastOfType<String, String>(json, r'parameters'),
        links: Links.mapFromJson(json[r'links']));
  }
  throw Exception('value is not a map');
}