Skip to content
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

new lint: avoid_overriding_widget_equals #1783

Closed
pq opened this issue Oct 23, 2019 · 3 comments
Closed

new lint: avoid_overriding_widget_equals #1783

pq opened this issue Oct 23, 2019 · 3 comments
Labels
customer-flutter lint-request type-enhancement A request for a change that isn't a bug

Comments

@pq
Copy link
Member

pq commented Oct 23, 2019

Follow-up from flutter/flutter#41220 (comment) (and flutter/flutter#1220).

Intent: disallow overriding == and hashCode in Widget subclasses.

Discussion: consider a general solution such as a @final annotation (or extending @sealed in package:meta).

/cc @bwilkerson @Hixie

@pq pq added type-enhancement A request for a change that isn't a bug lint-request customer-flutter labels Oct 23, 2019
@pq
Copy link
Member Author

pq commented Oct 23, 2019

The more I think about this, the more inclined I am to tackle the case generally w/ an annotation in meta (dart-lang/sdk#34378) and general purpose enforcement in analyzer. Would love to hear other folk's thoughts...

@Hixie
Copy link

Hixie commented Oct 23, 2019

I definitely prefer general lints that are triggered by annotations (a la @immutable) than Flutter-specific things.

@pq
Copy link
Member Author

pq commented Oct 30, 2019

We went ahead and took a general approach and implemented @nonVirtual in package:meta:

image

To take advantage Widget should get annotated. (And possibly elsewhere too.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-flutter lint-request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

2 participants