rename 'fromMap' and 'toMap' to 'fromJson' and 'toJson' to make compatible with json_serializable
Opened this issue · 6 comments
I think better to rename fromMap and toMap to fromJson and toJson to make compatible with the package 'json_serializable'.Package 'json_serializable' need the method named 'fromJson'.Or I think you can provide a setting for the name of serialize method.
I refrained from naming it fromJson
/ toJson
, because the generation does not work recursively. Only the current top-level class properties are put into the map. The properties do not get converted to map
, even if they are objects.
Certainly, in your case it might help renaming the method. It will work fine as long as you are just using primitives. But most certainly it will not.
This issue requires a bit more work, since the generator does not know which property is an object / primitive type.
I got it.Thanks.
I think I am also in need of this feature right now.
I am thinking of hardcoding List
and Map
and primitive types to be serialized in a specific way and rely on all other classes to have a toJson
/ fromJson
as well.
If anyone has any suggestions, feel free to comment
it is possible to change name of copyWith method in the settings of this plugin, why not to add such possiblity for toMap and fromMap?
any updates?
No updates. I have still the same opinion as I had before and I don't work anymore in Dart / Flutter. Possibility to rename toMap
and fromMap
might make sense, but I don't have time to update this plugin.