prefer-named-parameters
Suggests converting positional parameters to named parameters when a declaration has a certain number of positional parameters.
⚙️ Config
Set max-number
(default is 1
) to configure the number of allowed positional parameters.
dart_code_metrics:
...
rules:
...
- prefer-named-parameters:
max-number: 3
Example
❌ Bad:
class Some {
final String value;
final String another;
const Some(this.value, this.another); // LINT
}
✅ Good:
class Some {
final String value;
final String another;
const Some(this.value, {required this.another});
}