continue_ label_ invalid
(Previously known as continue_label_on_switch)
The label used in a 'continue' statement must be defined on either a loop or a switch member.
Description
#
The analyzer produces this diagnostic when the label in a continue
statement resolves to a label on a switch statement.
Example
#
The following code produces this diagnostic because the label l, used to
label a switch statement, is used in the continue statement:
void f(int i) {
l: switch (i) {
case 0:
continue l;
}
}
Common fixes
#
Find a different way to achieve the control flow you need; for example, by
introducing a loop that re-executes the switch statement.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.