-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Flutter uses the analyzer lint prefer_const_constructors. We love it!
Occasionally, we are able to refactor a class that wasn't const to be const. When this class lives in dart:ui, the lint lets us know where in the framework to update the constructors.
Our problem comes when we have internal customers who get the latest Flutter framework but sometimes are behind by some commits on dart:ui (because they have a custom embedder that doesn't update quite in sync with google3 for example). In a recent case, there are over 800 callsites for the changed constructor, and adding one-off ignores for all of them isn't practical. Turning off the lint also isn't desirable.
It would be really great if we could add a list of class exceptions to prefer_const_constructors, maybe something like
const_constructor_excludes:
- Rect.fromLTRB
- RRect.whatever
So that we could disable the lint for just those constructors while our consumers have time to catch up, but also wouldn't require us to turn the lint completely off for large refactors like this.
/cc @cbracken who probably has more ideas about this.