parse static method

AvroType parse(
  1. String schema
)

Parse type from json Can parse raw string type like long

Implementation

static AvroType<dynamic> parse(String schema) {
  late final Map<String, dynamic> json;
  try {
    json = jsonDecode(schema) as Map<String, dynamic>;
  } on FormatException catch (_) {
    json = {'type': schema};
  } catch (_) {
    if (schema == 'null') {
      json = {'type': 'null'};
    } else {
      rethrow;
    }
  }

  return AvroType.fromJson(json);
}