Skip to content
pubscout

to_csv

6.0.1, released a year ago by launchcode.shop

Create and download CSV or Excel files from lists of data with ease.

$ flutter pub add to_csv
Source repository

What it does

Allows developers to generate and download or share CSV and Excel files directly from lists of strings. Supports headers, custom file names, removing duplicate values, empty rows configuration, and data transposition.

AI-written summary of version 6.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to export tabular data to a CSV or Excel file in a Flutter application.
  • You want a simple API to download or share formatted text-based tables on Android, iOS, Windows, macOS, and Linux.

Skip it when

  • You need advanced Excel formatting, cell styling, formulas, or multiple sheets.
  • You are working in a pure Dart backend environment without Flutter dependencies.

Strengths

  • Easy to use with minimal code setup.
  • Supports cross-platform file saving and sharing.
  • Includes configuration options for empty rows, duplicate removal, and transposition.

Weaknesses

  • Limited strictly to string-based lists as input.
  • License is unknown.
  • iOS configuration requires manual edits to Info.plist.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
8

For iOS, you must add file sharing keys (LSSupportsOpeningDocumentsInPlace and UIFileSharingEnabled) to info.plist or through Xcode.

import 'package:to_csv/to_csv.dart' as exportCSV;

List<String> header = ['No.', 'User Name', 'Mobile', 'ID Number'];
List<List<String>> listOfLists = [
  ['1', 'Bilal Saeed', '1374934', '912839812'],
  ['2', 'Ahmar', '21341234', '192834821']
];

exportCSV.myCSV(header, listOfLists);

Alternatives

Packages that do the same job and could replace to_csv.

Works with

Packages commonly used together with to_csv: ones it builds on, ones built on it, and its own family.