avoid_ private_ typedef_ functions
Learn about the avoid_private_typedef_functions linter rule.
Avoid private typedef functions.
Details
#NOTE: As a private typedef can make some code more readable, this lint rule has been deprecated as of Dart 3.13 and is set to be removed in a future release of the Dart SDK. Remove all inclusions of this lint from your analysis options. If you wish to keep enforcing it, consider implementing the rule with an analyzer plugin.
AVOID private typedef functions used only once. Prefer inline function syntax.
BAD:
typedef void _F();
m(_F f);
GOOD:
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:
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:
linter:
rules:
avoid_private_typedef_functions: true
Unless stated otherwise, the documentation on this site reflects Dart 3.12.2. Report an issue.