use_function_type_syntax_for_parameters
Use generic function type syntax for parameters.
Details
#Use generic function type syntax for parameters.
BAD:
Iterable<T> where(bool predicate(T element)) {}
GOOD:
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:
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:
linter:
rules:
use_function_type_syntax_for_parameters: true
Unless stated otherwise, the documentation on this site reflects Dart 3.7.1. Page last updated on 2025-03-07. View source or report an issue.