fromJson static method
What json holds, as toJson writes it. Throws a
DocumentFormatException for anything else.
Implementation
static ComponentHints fromJson(Object? json) {
if (json is! Map) {
throw DocumentFormatException('a component\'s hints are a map: $json');
}
final id = _named(json, 'id', 'a component');
return ComponentHints(
id: id,
title: switch (json['title']) {
final String title => title,
_ => id,
},
fields: _fieldsOf(json['fields'], 'the component "$id"'),
entityTypes: _wordsOf(
json['entityTypes'],
'the component "$id"',
'entityTypes',
),
);
}