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

Integration with https://pub.dev/packages/built_value #276

Closed
sarvex opened this issue May 15, 2020 · 3 comments
Closed

Integration with https://pub.dev/packages/built_value #276

sarvex opened this issue May 15, 2020 · 3 comments
Labels
good first issue Good for newcomers wontfix This will not be worked on

Comments

@sarvex
Copy link

sarvex commented May 15, 2020

I have a simple application which flutter_form_builder to get user values and then send them to be backend with a POST method. Currently I have to do a lot of error-prone boilerplate coding to convert the Map to built_value.

It would be a lot better if there was a standardized way to serialize form_builder map to built_values.

@danvick
Copy link
Collaborator

danvick commented May 16, 2020

Hi @sarvex,
Thanks for your suggestion.

I, however, think that this would be near-impossible to achieve since each user of the package aims to use the package in their own way.

If we were to serialize the resulting map into a class object, that would mean that we would have to know the shape of the intended class - which is not possible.
There are also so many packages to convert maps to objects and using one (built_value in this case) within the package will be some form of vendor lock-in which is undesirable.

I also feel that this is not the purpose for which this package was intended and that would bring unnecessary complications to this package.

If you still feel that this is achievable and necessary to be part of the package, kindly submit a PR that will be reviewed and if possible, merged into the repo.

@danvick danvick added good first issue Good for newcomers wontfix This will not be worked on labels May 16, 2020
@sarvex
Copy link
Author

sarvex commented Jun 10, 2020

Hi @danvick

The Shape under consideration here is managed by build_value - using generated code for the actual implementation specifying the shape in form of Fields.

Then use the serialisation object to serialise in the specified format.
static Serializer<Login> get serializer => _$loginSerializer;
Serializers serializers = _$serializers;

Currently built_value has a Map based serialiser and a JSON serialiser.

So either we can use the existing serialiser (map based) to communicate with the Form Builder State or create a custom serialiser to have the specified valued in the current format.

@danvick
Copy link
Collaborator

danvick commented Jul 4, 2020

If you have an easy way of achieving this without a big impact on the package and how it will be used, kindly raise a PR and we'll review.
Thanks.

@danvick danvick closed this as completed Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants