sdk
sdk copied to clipboard
Request: `unused_field` for public properties, methods of private classed
The unused_field lint and its variants are very useful. But they have a flaw:
They work only for private members.
Consider:
class _A {
int unused;
}
Where _A is used but _A.unused is not, then in that situation we do not know that unused is not used.
Since _A is private, it should be feasible to know if the field unused is used or not.
A naive first implementation could consider that a public member of a private class is unused if:
- it's not used in the file + its parts
- it is not inherited from a super-class (not annotated with
@override) - the class it belongs to is not implemented/extended
- There are no public instances of the private class available