prefer-explicit-parameter-names
Warns when parameter names in function types are omitted.
Parameter names are used by IDEs code completion instead of default names like p0
and p1
. Therefore, providing them can improve the overall DX.
Example
❌ Bad:
class LayoutBuilder {
LayoutBuilder({this.builder});
final Widget Function(BuildContext, ConstraintType) builder; // LINT
}
✅ Good:
class LayoutBuilder {
LayoutBuilder({this.builder});
final Widget Function(BuildContext context, ConstraintType constraints) builder;
}