Skip to content

Files

Latest commit

 

History

History
35 lines (23 loc) · 550 Bytes

empty_statements.md

File metadata and controls

35 lines (23 loc) · 550 Bytes

Pattern: Empty statement

Issue: -

Description

Empty statements almost always indicate a bug.

For example,

Example of incorrect code:

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

Formatted with dartfmt the bug becomes obvious:

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

Better to avoid the empty statement altogether.

Example of correct code:

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

Further Reading