avoid-referencing-discarded-variables
preset: recommended
Warns when a variable with the name that has only underscores (ex. _
, __
, etc.) is referenced.
Example
❌ Bad:
void main() {
final _ = 'some value';
print(_); // LINT
}
✅ Good:
void main() {
final value = 'some value';
print(value);
}
void main() {
final _ = 'some value';
// no other code that references _
}