unused_element
false-positive when using super parameters on private classes
#58750
Labels
devexp-linter
Issues with the analyzer's support for the linter package
legacy-area-analyzer
Use area-devexp instead.
Describe the issue
Consider the following code:
This code won't trigger any info/warning.
However, if I use super parameters instead:
The following info will be issued:
info: A value for optional parameter 'key' isn't ever given. (unused_element at [...] lib/...)
To Reproduce
Use the code above with Dart 2.17+ and
unused_elements
enabled.Expected behavior
The linter should behave equally for both codes, as they are virtually the same. When using super parameters, however, the linter will incorrectly fire an info.
Additional context:
This issue, obviously, won't happen if the class is public.
Possible workaround:
A possible workaround is to provide a value, like
({super.key = null})
. However, it does conflict withavoid_init_to_null
.The text was updated successfully, but these errors were encountered: