prefer-wildcard-pattern
preset: recommended
Warns when a dynamic
or Object
type is used instead of a wildcard pattern.
Example
❌ Bad:
final object = WithField('hello');
final value = switch (object) {
WithField() => 'good',
Object() => 'bad', // LINT
dynamic() => 'bad', // LINT
};
✅ Good:
final object = WithField('hello');
final value = switch (object) {
WithField() => 'good',
_ => 'good',
};