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);
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。