Skip to content

[Feature request] Support for parsing the header #72

@orkun1675

Description

@orkun1675

The current API of accesing fields values is:

List<List<dynamic>> rows = const CsvToListConverter(
      eol: '\n',
      shouldParseNumbers: false,
    ).convert(fileContents);

// Row zero has the headers; discard it.
String idColumnValue = rows[1][0];

Which works if the file columns are guranteed to be in a static order.

It would be great if we could access columns values by their name:

List<List<dynamic>> rows = const CsvToListConverter(
      eol: '\n',
      shouldParseNumbers: false,
      parseHeaders: true, // New config option
    ).convert(fileContents);

// Row zero had headers but was parsed and dropped.
String idColumnValue = rows[0]["id"];

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions