unused_ label
Details about the 'unused_label' diagnostic produced by the Dart analyzer.
The label '{0}' isn't used.
Description
#The analyzer produces this diagnostic when a label that isn't used is found.
Example
#
The following code produces this diagnostic because the label loop isn't
referenced anywhere in the method:
void f(int limit) {
loop: for (int i = 0; i < limit; i++) {
print(i);
}
}
Common fixes
#If the label isn't needed, then remove it:
void f(int limit) {
for (int i = 0; i < limit; i++) {
print(i);
}
}
If the label is needed, then use it:
void f(int limit) {
loop: for (int i = 0; i < limit; i++) {
print(i);
if (i != 0) {
break loop;
}
}
}
Unless stated otherwise, the documentation on this site reflects Dart 3.10.3. Report an issue.