csv_plus v1.2.0
pub.dev GitHub

TSV and custom delimiters

The format is rarely just commas. Every separator is configurable.

Install#

dart pub add csv_plus
import 'package:csv_plus/csv_plus.dart';

Presets#

final tsv = CsvCodec.tsv();     // tab separated
final pipe = CsvCodec.pipe();   // pipe separated
final excel = CsvCodec.excel(); // ';' delimiter plus a UTF-8 BOM

The Excel preset exists because Excel in many locales writes and expects semicolons, and drops non-ASCII characters when the file has no BOM.

Anything else#

final custom = CsvCodec(CsvConfig(
  fieldDelimiter: '::',
  quoteMode: QuoteMode.always,
  skipEmptyLines: true,
));

Reading one format and writing another#

final rows = CsvCodec.tsv().decode(tabSeparatedInput);
final out = CsvCodec().encode(rows); // comma separated