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

Mapper defaults to the first constructor #275

Open
jaumzera opened this issue Mar 6, 2020 · 2 comments
Open

Mapper defaults to the first constructor #275

jaumzera opened this issue Mar 6, 2020 · 2 comments
Labels
feature Request and implementation of a feature (release drafter)

Comments

@jaumzera
Copy link

jaumzera commented Mar 6, 2020

My entities were being fetched with all attributes set to null because I had a non-args named constructor (e.g MyEntity.empty()) before the all-args one.

I didn't find any mention about this on the docs.

https://github.com/vitusortner/floor/blob/39787be83195c28e46a0ec449d739d9dceea4416/floor_generator/lib/processor/entity_processor.dart#L225

@vitusortner
Copy link
Collaborator

Good find. We're currently just using the first constructor to create in-memory objects. I'll mention that in the README.

Do you have an idea how to improve this behavior?

@jaumzera
Copy link
Author

jaumzera commented Apr 3, 2020

I think the README is enough for now. But, who knows, maybe annotating the constructor you want to use for mapper, in scenarios where you have more than one.

@mqus mqus added the feature Request and implementation of a feature (release drafter) label May 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request and implementation of a feature (release drafter)
Development

No branches or pull requests

3 participants