fromJson static method
Implementation
static AvroType<dynamic> fromJson(Map<String, dynamic> json) {
final dynamic untypedType = json['type'];
if (untypedType == null) {
throw Exception('No type specified');
}
if (untypedType is List) {
return UnionType.fromJson(json);
}
final String type = untypedType as String;
switch (type) {
case 'null':
return NullType.fromJson();
case 'boolean':
return BooleanType.fromJson();
case 'int':
return IntType.fromJson();
case 'long':
return LongType.fromJson();
case 'float':
return FloatType.fromJson();
case 'double':
return DoubleType.fromJson();
case 'bytes':
return BytesType.fromJson();
case 'string':
return StringType.fromJson();
case 'record':
return RecordType.fromJson(json);
case 'array':
return ArrayType.fromJson(json);
case 'enum':
return EnumType.fromJson(json);
case 'map':
return MapType.fromJson(json);
case 'fixed':
return FixedType.fromJson(json);
}
throw UnimplementedError('$type type not implemented');
}