Lint: Avoid using function types as a runtime Type
#57827
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
customer-google3
devexp-linter
Issues with the analyzer's support for the linter package
linter-lint-request
P3
A lower priority bug or feature request
type-enhancement
A request for a change that isn't a bug
From @matanlurey on November 13, 2018 1:29
I don't know how this lint request will interact with the generalized typedef language proposals
In Dart 2.x,
typedef
relates directly to its structural type, and is not a "type" itself. Which means:Due to the severe restrictions of using mirrors in any real code, treating a
typedef
definition as a runtimeType
is not useful in anyway, and can be very confusing/error prone to users (see above). There is some resistance to amending the style guide (dart-lang/site-www#1221), which I think is on point - so instead I opened this request.With this lint, you'd see:
I don't see any real downsides to this lint.
/cc @natebosch @munificent @leafpetersen @srawlins
Copied from original issue: #35144
The text was updated successfully, but these errors were encountered: