Skip to main content

avoid-continue

Warns when the continue statement is used.

continue statements can be confusing (especially, if used under certain conditions) and can complicate refactoring. Consider rewriting your code without them.

Example

❌ Bad:

for (final value in _values) {
if (_value == 1) {
// LINT: Avoid continue statements. Try rewriting the code without it.
continue;
}
}

✅ Good:

for (final value in _values) {
if (_value != 1) {
...
}
}