Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart: Can we fix all prefer_constant_constructors with some tool?

I added prefer_const_constructors linter rule to my analysis_options.yaml and it found over 500+ issues where const is missing in my project. Is there any tool that can fix all problems without doing it manually?

like image 969
Adam Smaka Avatar asked Feb 05 '21 10:02

Adam Smaka


People also ask

How do you fix the const in flutter?

Fix all const warning in flutter For stopping this warning mark open analysis_options. yaml and change following rule and save the file. After saving the file it will stop showing warning for missing const keywords in constructor.

How do I get rid of prefer const with constant constructors in flutter?

To avoid the prefer const with constant constructors warning add this rule prefer_const_constructors : false to the analysis_options. yaml file.

What is Linter in dart?

The linter gives you feedback to help you catch potential errors and keep your code in line with the published Dart Style Guide. Enforceable lint rules (or "lints") are cataloged here and can be configured via an analysis options file.


1 Answers

enter image description here

Try using this in your .vscode/settings.json to solve all lints of the file on saving

like image 101
Juned Raza Avatar answered Nov 15 '22 10:11

Juned Raza