fromJson static method

ContainerItem fromJson(
  1. dynamic value
)
override

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

Implementation

// ignore: prefer_constructors_over_static_methods
static ContainerItem fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return ContainerItem(
      ctype: mapValueOfType<String>(json, r'ctype') ?? '',
      models: mapValueOfType<Map<String, dynamic>>(json, r'models'),
      content: Pointer.fromJson(json[r'content']),
      meta: ComponentMeta.fromJson(json[r'meta']),
      links: Links.mapFromJson(json[r'links']),
      id: mapValueOfType<String>(json, r'id'),
      label: mapValueOfType<String>(json, r'label'),
      name: mapValueOfType<String>(json, r'name'),
      type: ElementTypeEnum.fromJson(json[r'type']),
    );
  }
  throw Exception('container item value is not a map');
}