fromJson static method
Factory method: parse a JSON representation into a concrete DataType.
Looks up the correct subclass in _dataTypes.
Implementation
static StructDataType fromJson(Map<String, dynamic> data) {
if (data['type'] != 'struct') {
throw Exception("Expected type 'struct', got '${data['type']}'");
}
final rawFields = data["fields"] as Map<String, dynamic>? ?? const {};
return StructDataType(
nullable: data["nullable"],
metadata: data["metadata"],
fields: rawFields.map((key, value) => MapEntry(key, DataType.fromJson(value as Map<String, dynamic>))),
);
}