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.9.2. Report an issue.