no_wildcard_variable_uses
The referenced identifier is a wildcard.
Description
#The analyzer produces this diagnostic when either a parameter or local variable whose name consists of only underscores is referenced. Such names will become non-binding in a future version of the Dart language, making the reference illegal.
Example
#The following code produces this diagnostic because the name of the parameter consists of two underscores:
// @dart = 3.6
void f(int __) {
print(__);
}
The following code produces this diagnostic because the name of the local variable consists of a single underscore:
// @dart = 3.6
void f() {
int _ = 0;
print(_);
}
Common fixes
#If the variable or parameter is intended to be referenced, then give it a name that has at least one non-underscore character:
void f(int p) {
print(p);
}
If the variable or parameter is not intended to be referenced, then replace the reference with a different expression:
void f() {
print(0);
}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.