always_put_control_body_on_new_line

Group: style

Maturity: stable

Linter v0.1.31

Since info is static, may be stale

View all Lint Rules

Using the Linter

From the flutter style guide:

DO separate the control structure expression from its statement.

Don't put the statement part of an if, for, while, do on the same line as the expression, even if it is short. Doing so makes it unclear that there is relevant code there. This is especially important for early returns.

GOOD:

if (notReady)
  return;

if (notReady)
  return;
else
  print('ok')

while (condition)
  i += 1;

BAD:

if (notReady) return;

if (notReady)
  return;
else print('ok')

while (condition) i += 1;