Skip to content

Add an option to explicitly call toJson when generating serialization code #192

Closed
@jmrboosties

Description

@jmrboosties

So rummaging through some older issues, I found that the expected way to handle an structure like:

User
---List<Favorites>

Is to do something like this:

Map<String, dynamic> jsonObject = json.decode(json.encode(user)); //json is from dart:convert

Instead of the normal user.toJson which works with objects without other nested objects inside of them. This isn't a huge deal, but it just makes the code look a little weird. If there's a better way to do this please let me know. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions