over_react_cascaded_arrow_functions

Severity: AnalysisErrorSeverity.ERROR

Maturity: stable

Since 1.0.0

View the Project on GitHub workiva/over_react

ALWAYS surround arrow functions in cascading setters with parentheses.

Otherwise, subsequent cascades do not work properly.

GOOD:

EventTarget target;

(Dom.button()
  ..onClick = ((event) => eventTarget = event.target)
  ..id = 'foo'
)()

BAD:

EventTarget target;

(Dom.button()
  ..onClick = (event) => eventTarget = event.target
  // This id will not get set on the button
  ..id = 'foo'
)()