Is there an analyzer option I can use in analysis_options.yaml
that will notify me when I could use the const
keyword? It would be nice to be notified about all the places in my code where I can use it.
Solution 1: Rémi Rousselet
What you're looking for is prefer_const_constructors
Solution 2: jamesdlin
There are a few dartanalyzer lints related to const
:
- prefer_const_constructors
- prefer_const_constructors_in_immutables
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
Also:
You can see the full list of supported lint rules.