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

Is there a way to use the map type adapter on a nested class using toJson? #1271

Open
joshpetit opened this issue Jan 19, 2024 · 0 comments
Open

Comments

@joshpetit
Copy link

For example, if we were to have a class such as:

class Dog {
  String name;
  Trait trait  
}

class Trait {
  String traitName;
  TraitAction action;
  Map<String, dynamic> toJson() => ....
  Trait.fromJson(...);
}

Would it be possible to create a type adapter for Dog that converts the nested trait object into json rather than having to create a new type adapter for the trait class?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant