Lint for one-member abstract class when a simple function will do (Style Guide). #57160
Labels
analyzer-linter
Issues with the analyzer's support for the linter package
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
type-enhancement
A request for a change that isn't a bug
From the style guide:
AVOID defining a one-member abstract class when a simple function will do.
Unlike Java, Dart has first-class functions, closures, and a nice light syntax for using them. If all you need is something like a callback, just use a function. If you're defining an class and it only has a single abstract member with a meaningless name like
call
orinvoke
, there is a good chance you just want a function.GOOD:
BAD:
The text was updated successfully, but these errors were encountered: