Is there a way to automatically fix all of the possible lint warnings in the whole project in Android Studio?
Solution 1
first within the project do : dart fix --dry-run then after it finish use : dart fix --apply
Solution 2
In Android Studio in the top Menu use
"Analyze" -> "Code Cleanup"
If that doesn't fix it you have to go manually through the result of
"Analyze" -> "inspect code"
See https://developer.android.com/studio/write/lint#manuallyRunInspections

Thomas
Updated on December 22, 2022Comments
-
Thomas about 13 hours
Imagine you have a project with thousands of lint warnings after you set up analysis_options.yaml file properly. And now you need to fix all of the mess you have. Doing it all by hand can cost you a lot of time, while most of the issues are very simple like "var" instead of "final", double quotes instead of single, etc.
Is there any way to make Android Studio automatically fix all of the easiest lint warnings like "Prefer const with constant constructors", etc. in terminal or by running any specific command?
-
giorgio79 about 1 yearI notice some issues are not fixed, eg "Prefer const with constant constructors"... Is there a way to fix those as well?
-
rubo77 about 1 yearwhere do you enter
dart fix --dry-run
in the GUI?