CsvConfig constructor

const CsvConfig({
  1. String fieldDelimiter = ',',
  2. String lineDelimiter = '\r\n',
  3. String quoteCharacter = '"',
  4. String? escapeCharacter,
  5. QuoteMode quoteMode = QuoteMode.necessary,
  6. bool addBom = false,
  7. bool autoDetect = true,
  8. bool skipEmptyLines = true,
  9. bool hasHeader = false,
  10. bool dynamicTyping = true,
  11. bool parseDates = false,
  12. bool strict = false,
  13. String? comment,
  14. int skipRows = 0,
  15. int? maxRows,
  16. bool skipInitialSpace = false,
  17. Set<String> nullValues = const <String>{},
  18. String? nullPlaceholder,
  19. CsvDateOrder dateOrder = CsvDateOrder.iso,
  20. Map<String, int> monthNames = const {},
  21. bool trimFields = false,
  22. Map<String, bool> boolValues = const <String, bool>{},
  23. dynamic decoderTransform(
    1. dynamic value,
    2. int index,
    3. String? header
    )?,
  24. dynamic encoderTransform(
    1. dynamic value,
    2. int index,
    3. String? header
    )?,
})

Create a CSV configuration.

All parameters have sensible defaults (RFC 4180 compatible). Named presets CsvConfig.excel, CsvConfig.tsv, CsvConfig.pipe are available for common formats.

Implementation

const CsvConfig({
  this.fieldDelimiter = ',',
  this.lineDelimiter = '\r\n',
  this.quoteCharacter = '"',
  String? escapeCharacter,
  this.quoteMode = QuoteMode.necessary,
  this.addBom = false,
  this.autoDetect = true,
  this.skipEmptyLines = true,
  this.hasHeader = false,
  this.dynamicTyping = true,
  this.parseDates = false,
  this.strict = false,
  this.comment,
  this.skipRows = 0,
  this.maxRows,
  this.skipInitialSpace = false,
  this.nullValues = const <String>{},
  this.nullPlaceholder,
  this.dateOrder = CsvDateOrder.iso,
  this.monthNames = const {},
  this.trimFields = false,
  this.boolValues = const <String, bool>{},
  this.decoderTransform,
  this.encoderTransform,
}) : escapeCharacter = escapeCharacter ?? quoteCharacter;