prefer_conditional_assignment

Group: style

Maturity: stable

Dart SDK: >= 2.0.0 • (Linter v0.1.31)

Since info is static, may be stale
pedantic

View all Lint Rules

Using the Linter

PREFER using ??= over testing for null.

As Dart has the ??= operator, it is advisable to use it where applicable to improve the brevity of your code.

BAD:

String get fullName {
  if (_fullName == null) {
    _fullName = getFullUserName(this);
  }
  return _fullName;
}

GOOD:

String get fullName {
  return _fullName ??= getFullUserName(this);
}