-
Notifications
You must be signed in to change notification settings - Fork 1.7k
overridden_fields should not lint if more specific type is used #57548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why not @a14n? The rule says: DON'T override fields. That means that should lint all overriden fields even if they are useful or not? |
If I remove the field in the child class I loose the type information that message is a String. BTW I can't find this rule in Effective Dart. |
That was a DDC and strong-mode restriction that overriding fields was not supported, which was fixed recently. |
Thanks for the explanation. I will try to refactor the code and perhaps close this issue. |
This lint does not come from effective dart but rather from #25567 I don't think it is intended that rules come from effective dart. I myself have had cases where I want to tighten the type on the extending class, can it be annotated in the base class? like with |
The FlutterError code above is bogus. It's introducing a new field which means the object has two slots but should only have one. It should just say: @override
String get message => super.message; ...and the constructor should pass When we wrote FlutterError, AssertionError didn't have a message field. |
@Hixie thanks |
The following code snippet from Flutter has a lint on FlutterError#message but shouldn't IMHO.
The text was updated successfully, but these errors were encountered: