Skip to content

openRead returns one more layer of [] #77

Closed

Description

@taosimple
final data = await file
        .openRead()
        .transform(utf8.decoder)
        .transform(csv.decoder)
        .toList()

Upgrade from ^6.0.0 to csv: ^7.2.0, openRead returns one more layer of [], and now to read the header, it needs to be data.first.first. Is it working as expected or is it a bug?

[
    [
        [
            "Amount",
            "link-one",
            "Name",
            "Status",
            "Tags",
            "Done",
            "Done (文本)",
            "Created Time",
            "单向",
            "双向1",
            "双向1A",
            "双向1B"
        ],
        [
            "1.55",
            "1.55",
            "HelloKitty ",
            "Pending",
            "Archive, Important",
            "true",
            "true",
            "2026/02/25 11:30",
            "Beta Value 16",
            "Beta Value 16, Upsilon Entry 35",
            "HelloKitty , Okay ",
            "1.55"
        ],
        [
            "2.23",
            "2.23",
            "Okay ",
            "In Progress",
            "Important",
            "true",
            "true",
            "2026/02/26 11:30",
            "",
            "",
            "",
            "1.55"
        ],
        [
            "3",
            "3, 40",
            "Epsilon Data 29",
            "Completed",
            "Archive",
            "true",
            "true",
            "2026/02/27 11:30",
            "Eta Data 90",
            "Omicron Data 92",
            "Sigma Entry 95",
            ""
        ],
        [
            "40",
            "",
            "Sigma Entry 95",
            "Pending",
            "Archive",
            "false",
            "null",
            "2026/02/28 11:30",
            "",
            "",
            "Iota Value 73",
            "3"
        ],
        [
            "5",
            "",
            "Iota Value 73",
            "Completed",
            "Urgent, Review, Important",
            "false",
            "null",
            "2026/03/01 11:30",
            "",
            "",
            "",
            "40"
        ],
        [
            "672.0",
            "",
            "Delta Item 86",
            "Cancelled",
            "Archive",
            "true",
            "true",
            "2026/03/02 11:30",
            "",
            "",
            "Delta Item 86",
            "672.0"
        ],
        [
            "461.0",
            "",
            "Upsilon Data 11",
            "Completed",
            "Urgent",
            "false",
            "null",
            "2026/03/03 11:30",
            "",
            "",
            "Sigma Data 36",
            ""
        ],
        [
            "517.0",
            "",
            "Upsilon Value 90",
            "Cancelled",
            "Archive",
            "true",
            "true",
            "2026/03/04 11:30",
            "",
            "",
            "",
            ""
        ],
        [
            "969.0",
            "",
            "Sigma Data 36",
            "In Progress",
            "Important, Archive, Urgent",
            "true",
            "true",
            "2026/03/05 11:30",
            "",
            "",
            "",
            "461.0"
        ],
        [
            "911.0",
            "",
            "Nu Value 53",
            "In Progress",
            "Important, Urgent",
            "true",
            "true",
            "2026/03/06 11:30",
            "",
            "",
            "",
            ""
        ]
    ]
]

Activity

  1. IlyaOstashkov commented on Mar 15, 2026

    @IlyaOstashkov

    Yeah, that's bothering me too. I rolled back to version 6. Were you able to fix it?

  2. close2 commented on Mar 16, 2026

    @close2
    Owner

    The additional layering is necessary to be a codec.
    I remember now, that I had this exact situation already and removed codec compatibility in commit 235d89...

    I will either create a new major version with a similar fix or add additional functions:

    class CsvCodec extends Codec<List<List<dynamic>>, String> {
      @override
      CsvEncoder get encoder => _encoder;
      
      @override
      CsvDecoder get decoder => _decoder;
      
      /// Stream transformer that emits individual rows.
      /// Use this with Stream.transform() instead of [decoder].
      StreamTransformer<String, List<dynamic>> get rowDecoder => ...;
      
      /// Stream transformer that accepts individual rows.
      StreamTransformer<List<dynamic>, String> get rowEncoder => ...;
    }

    I might then even deprecate the current functions.

    Not sure yet. In any case expect a fix in the next days.

  3. close2 commented on Mar 19, 2026

    @close2
    Owner

    Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions