cascade_invocations

Group: style

Maturity: stable

Linter v0.1.29

Since info is static, may be stale

View all Lint Rules

Using the Linter

DO Use the cascading style when successively invoking methods on the same reference.

BAD:

SomeClass someReference = SomeClass();
someReference.firstMethod();
someReference.secondMethod();

BAD:

SomeClass someReference = SomeClass();
...
someReference.firstMethod();
someReference.aProperty = value;
someReference.secondMethod();

GOOD:

SomeClass someReference = SomeClass()
    ..firstMethod()
    ..aProperty = value
    ..secondMethod();

GOOD:

SomeClass someReference = SomeClass();
...
someReference
    ..firstMethod()
    ..aProperty = value
    ..secondMethod();