Skip to main content

use_function_type_syntax_for_parameters

Stable
Recommended
Fix available

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