CsvSchema class

Defines constraints for CSV table validation.

Constructors

CsvSchema({required List<CsvColumnDef> columns, bool allowExtraColumns = true, bool allowMissingColumns = false})
Creates a schema from columns.
const
CsvSchema.infer(List<String> headers, List<List> rows)
Infer a schema from observed headers and data.
factory

Properties

allowExtraColumns → bool
Whether extra columns (not in schema) are allowed.
final
allowMissingColumns → bool
Whether fewer columns than defined are allowed.
final
columns → List<CsvColumnDef>
Column definitions.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

coerce(List<String> headers, List<List> rows) → List<List>
Coerce each column's values to its declared CsvColumnDef.type, returning freshly built rows (the input is left untouched).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
validate(List<String> headers, List<List> rows) → List<CsvValidationException>
Validate rows against this schema. Returns list of violations.

Operators

operator ==(Object other) → bool
The equality operator.
inherited