Skip to main content

avoid-unnecessary-continue

has auto-fix
pro+

Warns when a continue statement is unnecessary and can be removed.

Example

❌ Bad:

for (final value in _values) {
...

// LINT: Unnecessary continue statement. Try removing it.
continue;
}

for (final value in _values) {
...

if (_value == 1) {
...
} else {
// LINT: Unnecessary continue statement. Try removing it.
continue;
}
}

✅ Good:

for (final value in _values) {
...
}

for (final value in _values) {
...

if (_value == 1) {
...
}
}