avoid-nullable-parameters-with-default-values
preset: recommended
Warns when a parameter with the default value is marked as nullable.
Parameters with default values can never be null
(the default value will be assigned instead) and can be simply converted to non-null.
Example
❌ Bad:
void fn({int? a = 5}) {} // LINT: This parameter can be safely made non-nullable.
void fn([int? a = 5]) {} // LINT: This parameter can be safely made non-nullable.
✅ Good:
void fn({int? a}) {} // Correct, has no default value
void fn({required int a}) {}
void fn({int a = 5}) {} // Correct, marked non-nullable