use_function_type_syntax_for_parameters
Use generic function type syntax for parameters.
Details
#Use generic function type syntax for parameters.
BAD:
dart
Iterable<T> where(bool predicate(T element)) {}
GOOD:
dart
Iterable<T> where(bool Function(T) predicate) {}
Enable
#To enable the use_function_type_syntax_for_parameters
rule, add use_function_type_syntax_for_parameters
under linter > rules in your analysis_options.yaml
file:
analysis_options.yaml
yaml
linter:
rules:
- use_function_type_syntax_for_parameters
If you're instead using the YAML map syntax to configure linter rules, add use_function_type_syntax_for_parameters: true
under linter > rules:
analysis_options.yaml
yaml
linter:
rules:
use_function_type_syntax_for_parameters: true
Was this page's content helpful?
Thank you for your feedback!
Provide details Thank you for your feedback! Please let us know what we can do to improve.
Provide details Unless stated otherwise, the documentation on this site reflects Dart 3.8.1. Page last updated on 2025-03-07. View source or report an issue.