Skip to content

Improve toJson generation with some no-write null fields #33

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

Merged
merged 3 commits into from
Aug 21, 2017

Conversation

kevmoo
Copy link
Collaborator

@kevmoo kevmoo commented Aug 21, 2017

No description provided.

@kevmoo kevmoo requested a review from natebosch August 21, 2017 02:53
CHANGELOG.md Outdated
@@ -1,3 +1,8 @@
## 0.2.3

* Write out `toJson` methods more efficiently the first fields written are not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this missing a word or some punctuation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

$map['orders'] = orders;
return $map;
writeNotNull('middleName', middleName);
val['lastName'] = lastName;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can/should we get these other non-null fields into the initial map?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, no. We want to keep the fields in consistent order.

'firstName': firstName,
};

void writeNotNull(String key, dynamic value) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taking a look at this - I might skip the extra method and inline the conditionals through the rest. It's noisy but shouldn't matter since it's generated code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm. Maybe. Will look at in another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants