dart-json-mapper
dart-json-mapper copied to clipboard
Introduce converter for `MaterialColor` class in Flutter adapter
E/flutter (24684): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: It seems your class 'MaterialColor' has not been annotated with @jsonSerializable
i'm coming from the json_serializable package where these errors would instead occur when running build_runner
That's primarily because json_serializable is using static approach where you have literally all your code to be potentially used is generated in advance for you. dart_json_mapper instead, uses mostly dynamic approach, where you don't have most of the code generated for you in advance, this code does not exists until you actually use it in runtime. Technically it's difficult to oversee and predict beforehand which classes you would like to use until you annotate them explicitly or register them with an adapter.
There is an ignoreUnknownTypes option for you to ignore unknown types. Example is here
Or we could extend Flutter adapter to support this class for you seamlessly, what do you think?
Or we could extend Flutter adapter to support this class for you seamlessly, what do you think?
oh, i wasn't even aware there was a flutter adapter. i just tried it out and it seems to work fine with the Color class i'm using (i think i accidentally imported MaterialColor when i first raised this tho, i'm not actually using that class though it would probably be a good idea to support it)