fromJson static method

MaterialHints fromJson(
  1. Object? json
)

What json holds, as toJson writes it. Throws a DocumentFormatException for anything else.

Implementation

static MaterialHints fromJson(Object? json) {
  if (json is! Map) {
    throw DocumentFormatException('a material\'s hints are a map: $json');
  }
  final model = _named(json, 'model', 'a material');
  return MaterialHints(
    model: model,
    fields: _fieldsOf(json['fields'], 'the material "$model"'),
  );
}