avoid_private_typedef_functions
Avoid private typedef functions.
Details
#AVOID private typedef functions used only once. Prefer inline function syntax.
BAD:
dart
typedef void _F();
m(_F f);
GOOD:
dart
m(void Function() f);
Enable
#To enable the avoid_private_typedef_functions
rule, add avoid_private_typedef_functions
under linter > rules in your analysis_options.yaml
file:
analysis_options.yaml
yaml
linter:
rules:
- avoid_private_typedef_functions
If you're instead using the YAML map syntax to configure linter rules, add avoid_private_typedef_functions: true
under linter > rules:
analysis_options.yaml
yaml
linter:
rules:
avoid_private_typedef_functions: true
Unless stated otherwise, the documentation on this site reflects Dart 3.6.0. Page last updated on 2025-01-27. View source or report an issue.