Reputation: 167
After flutter 2.5 update, every widget that uses static data need to by put in const keyword
How to get ride of that warning to use const or how to auto insert const when we create widget in flutter code
Upvotes: 5
Views: 1648
Reputation: 4696
This is because by default we now have the flutter_lints
rules. It is a good practice to use the const
keyword. However if you feel like removing it, you can edit your static_analysis.yaml
file and add the following:
linter:
rules:
prefer_const_constructors: false
UPDATE 24/11/21
dart fix --apply
can now fix prefer_const_constructors
warnings.
Upvotes: 13