csv_plus v1.2.0
pub.dev GitHub

A CSV library for Dart

Parse, write, stream, query and validate CSV from Dart, with types inferred for you and no dependencies to pull in.

Install#

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

A first example#

final codec = CsvCodec();

final csv = codec.encode([
  ['name', 'age', 'score'],
  ['Alice', 30, 95.5],
  ['Bob', 25, 88.0],
]);

final rows = codec.decode(csv);
// rows[1] == ['Alice', 30, 95.5]  (String, int, double)

Note what came back. 30 is an int and 95.5 is a double, not strings you have to convert yourself.

Guides#

What it does#

  • RFC 4180 parsing, including quoted fields, embedded newlines and escaped quotes
  • Automatic type inference, guarded so identifier-like values are not corrupted
  • Typed decoders for whole grids, and per-column schemas with validation and coercion
  • A queryable table with filter, sort, aggregate and group
  • Streaming decode with backpressure, for files larger than memory
  • TSV, semicolon, pipe and fully custom delimiters, quoting and line endings
  • Comment preambles, leading-row skipping and row windowing
  • dart:convert integration, so it fuses with other codecs

Zero dependencies#

csv_plus depends on nothing outside the Dart SDK. That keeps your dependency graph small, avoids version conflicts in an app that already pins a lot, and means there is no transitive package to audit. The core library is pure Dart and runs anywhere Dart does, including the browser; file helpers live in a separate io.dart import so the core never pulls in dart:io.