-
Notifications
You must be signed in to change notification settings - Fork 412
Option to omit empty fields #26
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
Conversation
6ee1c16
to
e488748
Compare
Also handle fields with names that overlap with toJSON inline helpers
And update some comments
b248b44
to
7c131ad
Compare
lib/src/json_serializable.dart
Outdated
const JsonSerializable({bool createFactory: true, bool createToJson: true}) | ||
: this.createFactory = createFactory, | ||
this.createToJson = createToJson; | ||
/// [true] if the generator should include the this field in the serialized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] 'Whether the generator should...'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack
const JsonSerializable( | ||
{bool createFactory: true, | ||
bool createToJson: true, | ||
bool includeIfNull: true}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is true the default? Backwards compatibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. It can also lead to some weirdness – like having a completely empty Map returned from toJson – better to make it opt-in.
Also the code generated is a lot uglier.
7c131ad
to
86098bc
Compare
No description provided.