Part.fromJson constructor
Part.fromJson(})
Deserializes a part from a JSON map.
The converterRegistry parameter is a map of part types to converters.
Implementation
factory Part.fromJson(
Map<String, Object?> json, {
required Map<String, JsonToPartConverter> converterRegistry,
}) {
final type = json[typeKey] as String;
final JsonToPartConverter? converter = converterRegistry[type];
if (converter == null) {
throw UnimplementedError('Unknown part type: $type');
}
return converter.convert(json);
}