add const modifier - remove const keyword

Hi Guys, Welcome to Proto Coders Point. If you have upgraded your flutter SDK version to 2.5.0 you might been seeing a warning been shown on every widget that use static data to add ‘const’ modifier at the beginning on the widget.

This is because by default we now have the flutter_lints rules applied.

Video tutorial to remove const keyword requirement in flutter

How to get rid of const keyword in static widget - Flutter Tutorial - Flutter_Linter

How to remove const keyword requirement in flutter code

It is a good practive using the const keyword on any data type or widget that use static data.

However if you fill like removing it, you can edit your analysis_options.yaml file and add the following:

open analysis_option.yaml file & under linter > rules disable prefer_const_constructor.

    prefer_const_constructors : false

Then, after making prefer const constructors: false, you need to run a command in IDE terminal as below

dart fix