ArrowSchema.fromJson constructor
ArrowSchema.fromJson( - Map<String, Object?> json
)
Implementation
factory ArrowSchema.fromJson(Map<String, Object?> json) {
try {
final fields = json['fields'];
if (fields is! List) {
throw const FormatException('schema.fields must be a list');
}
return ArrowSchema(
fields.indexed
.map(
(entry) => ArrowField.fromJson(
_stringObjectMap(entry.$2, 'schema.fields[${entry.$1}]'),
),
)
.toList(),
allowDuplicateNames: true,
metadata: _metadataFromJson(
json['metadata'],
'schema.metadata',
present: json.containsKey('metadata'),
),
);
} on FormatException {
rethrow;
} on ArgumentError catch (error) {
throw FormatException('Invalid Arrow schema: $error');
} on TypeError catch (error) {
throw FormatException('Invalid Arrow schema shape: $error');
}
}