Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Support for parsing the header #72

Open
orkun1675 opened this issue Jul 13, 2024 · 0 comments
Open

[Feature request] Support for parsing the header #72

orkun1675 opened this issue Jul 13, 2024 · 0 comments

Comments

@orkun1675
Copy link

orkun1675 commented Jul 13, 2024

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"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants