avoid-misused-wildcard-pattern
Warns when a wildcard pattern is used in the wrong context.
Example
❌ Bad:
void fn() {
final animal = 'hello';
if (animal.isEmpty case _) {} // LINT: Avoid misused wildcard patterns. Try using another pattern instead.
final (Object _) = animal; // LINT: Avoid misused wildcard patterns. Try using another pattern instead.
if (animal.isEmpty case bool() && _) {} // LINT: Avoid misused wildcard patterns. Try using another pattern instead.
}
✅ Good:
void fn() {
final animal = 'hello';
if (animal.isEmpty case final isEmpty) {} // Correct, different pattern
final (Object object) = animal;
if (animal.isEmpty case final bool isEmpty) {}
}