hive
hive copied to clipboard
Is there a way to use the map type adapter on a nested class using toJson?
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?