fromJson static method
Implementation
static CompactCodecInterface fromJson(final Map<String, dynamic> json) {
if (json['type'] == null || json['id'] == null) {
throw Exception('Exception as didn\'t found the type for this json: $json');
}
final int id = json['id'];
final Map<String, dynamic> typeObject = json['type'];
final MapEntry defType = (typeObject['def'] as Map).entries.first;
return CompactCodecInterface(
id: id,
type: defType.value['type'],
path: typeObject['path']?.cast<String>(),
docs: typeObject['docs']?.cast<String>(),
);
}