Flutter 2.5 update - const keyword on every static Widget

570

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.

Share:
570
Rajat Palankar
Author by

Rajat Palankar

I am a tech geek who likes to contribute to society by continuously spreading his knowledge to you guys, I have Completed my “Master’s of the computer application ( M.C.A )” from Gogte Institute of Technology, Belgaum, I love to share my technical knowledge by writing programming blogs, I even like to use new tech Gadgets. I am interested mostly in Mobile Application Development mostly on Android and currently a beginner in Flutter Development. Check out my website : Proto Coders Point

Updated on January 01, 2023

Comments

  • Rajat Palankar
    Rajat Palankar over 1 year

    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

    enter image description here