Skip to main content

avoid-nullable-parameters-with-default-values

added in: 1.10.0
🛠

Warns when a parameter with the default value is marked as nullable.

Example

❌ Bad:

void fn({int? a = 5}) {} // LINT

void fn([int? a = 5]) {} // LINT

✅ Good:

void fn({int? a}) {}

void fn({required int a}) {}

void fn({int a = 5}) {}