Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[REQ] [Dart] Remove redundant null checks #3628

Closed
nickmeinhold opened this issue Aug 13, 2019 · 0 comments · Fixed by #3632
Closed

[REQ] [Dart] Remove redundant null checks #3628

nickmeinhold opened this issue Aug 13, 2019 · 0 comments · Fixed by #3632

Comments

@nickmeinhold
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The fromJson methods in my models have lots of redundant checks like this:

if (json['stop_distance'] == null) {
  stopDistance = null;
} else {
  stopDistance = json['stop_distance'];
}

Describe the solution you'd like

Remove redundant check and just assign:

stopDistance = json['stop_distance'];

Describe alternatives you've considered

I'll start a PR now, should just be a small change to class.mustache I believe.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant