DeepSource has joined Harness. Learn more
Dart Analyze logoDart Analyze/
DRT-W1018

Avoid empty statementsDRT-W1018

Major severityMajor
Bug Risk categoryBug Risk

AVOID empty statements.

Empty statements almost always indicate a bug.

For example,

BAD:

if (complicated.expression.foo());
  bar();

Formatted with dart format the bug becomes obvious:

if (complicated.expression.foo()) ;
bar();

Better to avoid the empty statement altogether.

GOOD:

if (complicated.expression.foo())
  bar();