Skip to content

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

Closed
@nickmeinhold

Description

@nickmeinhold

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions