fromDynamic static method
Parse avro type from dynamic schema Used to manage raw string type, Json object type or List for union
Implementation
static AvroType<dynamic> fromDynamic(dynamic schema) {
if (schema is Map<String, dynamic>) {
return AvroType.fromJson(schema);
}
if (schema is String) {
return AvroType.parse(schema);
}
if (schema is List) {
return UnionType(
type: schema.map((s) => AvroType.fromDynamic(s)).toList(),
);
}
throw UnimplementedError('${schema.runtimeType} type not implemented');
}