no_empty_block
A no_empty_block
rule which forbids having empty code blocks,
including function/method bodies and conditionals,
excluding catch blocks and to-do comments.
An empty code block often indicates missing code.
Example
BAD:
int fn() {} // LINT
Function getCallback() {
return (){}; // LINT
}
void main() {
if (true) {} // LINT
}
GOOD:
int fn() {
// TODO: complete this
}
Function getCallback() {
return () {
// TODO: actually do something
};
}
void main() {
if (true) {
print('');
}
try {
fn();
} catch (_) {} // ignored by this rule
}