prefer-correct-any-matcher
Warns when any or captureAny have incorrect or misused named argument.
Example
❌ Bad:
void main() {
test('some test', () {
final correct = Correct();
// LINT: This invocation stubs a positional argument and should not have the 'named' argument.
// Try removing this argument.
when(() => correct.work(any(named: 'named')));
// LINT: This invocation stubs a named argument and should have the 'named' argument.
// Try adding it.
when(() => correct.work(any(), namedValue: any()));
// LINT: The passed name of the argument does not match the actual argument name.
// Try updating the name.
when(() => correct.work(any(), namedValue: any(named: 'some')));
});
}
✅ Good:
void main() {
test('some test', () {
final correct = Correct();
when(() => correct.work(any()));
when(() => correct.work(any(), namedValue: any(named: 'namedValue')));
});
}