-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.customer-flutterdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
specify_parameter_names
Description
Specify names for the parameters of Function types.
Details
Dart allows omitting the name of parameters in function types:
class LayoutBuilder {
LayoutBuilder({this.builder});
final Widget Function(BuildContext, ConstraintType) builder;
}While that is legal, it degrades the experience of anyone using this widget with code completion in IDEs:
Since no names were given, unhelpful names are generated. This can be avoided by giving the parameters proper names:
class LayoutBuilder {
LayoutBuilder({this.builder});
final Widget Function(BuildContext context, ConstraintType constraints) builder;
}The proposed lint would enforce that function types must always contain names for the parameters to improve the experience for anyone using IDE and code completion.
See also flutter/flutter#119877.
Kind
Maybe style? It's kinda a usability thing when people work with IDEs, though.
Bad Examples
Widget Function(BuildContext, ConstraintType) builder;
typedef BuilderCallback = Widget Function(BuildContext, ConstraintType);Good Examples
Widget Function(BuildContext context, ConstraintType constraints) builder;
typedef BuilderCallback = Widget Function(BuildContext context, ConstraintType constraints);srawlins, a14n, pq and sullenel
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.customer-flutterdevexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-lint-proposallinter-status-pendingtype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
