-
Notifications
You must be signed in to change notification settings - Fork 183
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
null values are stripped when serializing #604
Comments
Not currently. We could potentially add it as a configuration setting on the serializer field.
From your side, you could post-process the data to add in the nulls, but that's a bit awkward unless you have the list of keys / field names handy. |
Well it's a bit of a pain point currently. We're probably gonna lean on post-processing, since it's cleaner than setting a string to Your suggested solution seems like a good, clean idea though. |
@davidmorgan This feature was stripped from v8 correct? If so, how to handle it? Our requirements remain the same: It is useful to serialize nulls when working with Firestore. |
Yes--but it looks like I could actually add it back--will aim to do so. |
With a global option and a per-field override? #912 |
Any workaround until this gets implemented? We have a ton of code that relies on this, from the old version. There's currently a lot of glitches related to saving data, which is to be expected, but not optimal. 😅 |
The serializer class can handle |
@davidmorgan Will you accept a PR that re-implements this? I assume the solution is similar to the last one? |
@kuhnroyal Thanks for the suggestion but we have more than 100 built value entities, so writing a custom serializer for most of them is probably gonna take longer than a PR. 😊 |
@larssn I agree. I implemented this in the OpenAPI generator by generating it from a mustache template: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/dart/libraries/dio/serialization/built_value/class.mustache#L58 I would also love to have something like |
@kuhnroyal My first priority is just to get it back to how it was. A |
Hello, thanks for a wonderful plugin. It's making our boilerplate related headacres go away.
However we're running into a minor issue serializing data into a Firestore compatible Map. The generated serializers are stripping out nulls (which makes sense in a JSON context).
The offending code is the
if
that is generated in the.g.dart
files, for example:If we comment it out, our resulting Map has keys with nulls, as desired.
Any way to make built_value not generate that
if
check?The text was updated successfully, but these errors were encountered: