avoid_returning_this

Group: style

Maturity: stable

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

View the Project on GitHub dart-lang/linter

AVOID returning this from methods just to enable a fluent interface.

Returning this from a method is redundant; Dart has a cascade operator which allows method chaining universally.

Returning this is allowed for:

BAD:

var buffer = new StringBuffer()
  .write('one')
  .write('two')
  .write('three');

GOOD:

var buffer = new StringBuffer()
  ..write('one')
  ..write('two')
  ..write('three');