join_return_with_assignment

Group: style

Maturity: stable

Linter v0.1.31

Since info is static, may be stale

View all Lint Rules

Using the Linter

DO join return statement with assignment when possible.

BAD:

class A {
  B _lazyInstance;
  static B get instance {
    _lazyInstance ??= B(); // LINT
    return _lazyInstance;
  }
}

GOOD:

class A {
  B _lazyInstance;
  static B get instance => _lazyInstance ??= B();
}