avoid-misused-wildcard-pattern
added in: 1.7.0
warning
Dart 3.0Warns when a wildcard pattern is used in the wrong context.
Example
❌ Bad:
void fn() {
final animal = 'hello';
if (animal.isEmpty case _) {} // LINT
final (Object _) = animal; // LINT
if (animal.isEmpty case bool() && _) {} // LINT
}
✅ Good:
void fn() {
final animal = 'hello';
if (animal.isEmpty case final isEmpty) {}
final (Object object) = animal;
if (animal.isEmpty case final bool isEmpty) {}
}