ArrowUnionType constructor
Implementation
ArrowUnionType(
List<ArrowField> fields, {
this.mode = ArrowUnionMode.sparse,
List<int>? typeIds,
}) : fields = List.unmodifiable(fields),
typeIds = List.unmodifiable(
typeIds ?? List.generate(fields.length, (i) => i),
) {
if (this.typeIds.length != fields.length) {
throw ArgumentError('Union typeIds length must match field count');
}
final seen = <int>{};
for (final id in this.typeIds) {
if (id < 0 || id > 127) throw RangeError.range(id, 0, 127, 'typeId');
if (!seen.add(id)) throw ArgumentError('Duplicate union type id: $id');
}
}