avoid-unnecessary-declaring-parameters
Suggests converting a declaring parameter to a regular parameter when it's not used outside of the primary constructor.
Example
❌ Bad:
// LINT: This declaring parameter can be converted to a regular parameter as it is not used outside the constructor.
// Try removing the 'final' keyword.
class Primary(final String _value) {
final another = _value;
final String third;
this : third = _value;
}
✅ Good:
class Primary(String _value) {
final another = _value;
final String third;
this : third = _value;
}
class Another(final String _value) {
void fn() {
print(_value);
}
}