Open nate-thegrate opened 5 hours ago
Summary: The user proposes expanding the @reopen
annotation to apply to class fields, allowing developers to maintain the protected status of overridden fields in subtypes. This would address the issue of overridden protected methods losing their protected status, leading to unintended autofill suggestions.
In case it helps with issue triage: I have an open PR to manually re-add annotations to each public State subtype's overridden methods, which would solve the problem with regards to Navigator.of(context)
.
When a
@protected
method (such as State.dispose) is overridden, it loses its "protected" status unless the annotation is re-applied.This has resulted in some less-than-ideal Flutter autofill suggestions:
Proposal
Maybe the
@reopen
annotation's usage could be expanded to cover class fields as well: restrictive annotations like@protected
would apply to any subtype's overridden fields by default, unless the field is "re-opened".(Would an analyzer change like this one count as "breaking"?)