Skip to content

Consider dart:convert supoort #13

Open

Description

@TekExplorer

Something I noticed was that dart:convert has its own codecs that act as stream transformers and can be composed.

Consider including some way to get a Codec out of Codables, and maybe Converters out of Encoders and Decoders

I tried to play around with it, but Im not familiar enough with it to do so

Activity

  1. TekExplorer commented on Feb 14, 2025

    @TekExplorer
    Author

    Perhaps it would require shifting the API a bit.

    Instead of generating toX and fromX as extensions directly, create a single getter like Person.codable.json and on that would be .codec, or perhaps that itself implements Codec which would allow you to do Person.codable.json.encode(person) and Person.codable.json.decode('{...}')

    And you can always do Person.codable.json.fuse(utf8) which would let you work with raw bytes instead.

    I think it has potential.

    We could still have to/fromX as conveniences, and only use the code when we care to, but I think there's a benefit.

  2. schultek commented on Feb 14, 2025

    @schultek
    Owner

    See #12

  3. TekExplorer commented on Feb 14, 2025

    @TekExplorer
    Author

    oh interesting

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