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

Introduce converter for MaterialColor class in Flutter adapter #183

Open
DetachHead opened this issue Apr 18, 2022 · 2 comments
Open

Introduce converter for MaterialColor class in Flutter adapter #183

DetachHead opened this issue Apr 18, 2022 · 2 comments
Assignees
Labels
adapter Issue related to specific adapter library, not mapper itself enhancement New feature or request sponsorware https://calebporzio.com/sponsorware

Comments

@DetachHead
Copy link

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

@k-paxian k-paxian added the question Further information is requested label Apr 18, 2022
@k-paxian
Copy link
Owner

k-paxian commented Apr 18, 2022

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?

@k-paxian k-paxian changed the title errors should occur at build time instead of at runtime Missing annotation errors should occur at build time instead of at runtime Apr 18, 2022
@DetachHead
Copy link
Author

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)

@k-paxian k-paxian added enhancement New feature or request and removed question Further information is requested labels Apr 19, 2022
@k-paxian k-paxian changed the title Missing annotation errors should occur at build time instead of at runtime Introduce support for MaterialColor class in Flutter adapter Apr 19, 2022
@k-paxian k-paxian self-assigned this Apr 19, 2022
@k-paxian k-paxian added the sponsorware https://calebporzio.com/sponsorware label Apr 21, 2022
@k-paxian k-paxian changed the title Introduce support for MaterialColor class in Flutter adapter Introduce converter for MaterialColor class in Flutter adapter Apr 30, 2022
@k-paxian k-paxian added the adapter Issue related to specific adapter library, not mapper itself label Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapter Issue related to specific adapter library, not mapper itself enhancement New feature or request sponsorware https://calebporzio.com/sponsorware
Projects
None yet
Development

No branches or pull requests

2 participants