Skip to main content

prefer-explicit-parameter-names

Warns when parameter names in function types are omitted.

Parameter names are used by the IDE's code completion instead of default names like p0 and p1. Therefore, providing them can improve the overall developer experience.

Example

❌ Bad:

class LayoutBuilder {
LayoutBuilder({this.builder});

// LINT: Prefer declaring names for function type parameters.
final Widget Function(BuildContext, ConstraintType) builder;
}

✅ Good:

class LayoutBuilder {
LayoutBuilder({this.builder});

// Correct, parameters have names
final Widget Function(BuildContext context, ConstraintType constraints) builder;
}