prefer-correct-setter-parameter-name
Warns when the setter parameter name does not match the configured one.
⚙️ Config
Set ignored-names
(default is empty) to ignore specific names.
Set allowed-names
(default is [value
]) to configure allowed names for the setter parameter.
dart_code_metrics:
...
rules:
...
- prefer-correct-setter-parameter-name:
allowed-names:
- newValue
Example
❌ Bad:
class Some {
String? _value;
// LINT
set prop(String someValue) {
_value = someValue;
}
}
✅ Good:
class Some {
String? _value;
set prop(String value) {
_value = value;
}
}