Reputation: 1092
I have the following warnings in Android Studio's Dart Analysis window that get detected in my Flutter code.
I want to fix them all by doing only one action
Is there any approach to do this?
Note that i'm working with Android Studio Arctic Fox | 2020.3.1 Patch 2 on MacOS Mojave 10.14.6
Upvotes: 1
Views: 2444
Reputation: 393
Firstly you can see all the warnings by typing in android studio terminal
dart fix --dry-run
Now if you want everything to be fixed in 1 command then write
dart fix --apply
It will fix every warning including adding const to your code where needed.
Upvotes: 0
Reputation: 55
Hover on any const warnings and go to more options. Then you will find to fix const warning of that particular file everywhere. Peace! ✌
Upvotes: 0
Reputation: 1092
They added a feature to the newest Android Studio versions, so we can fix all hints in the same file by one click.
Upvotes: 2
Reputation: 379
In the root dir of project, Goto => analysis_option.yaml file in the rules section add: prefer_const_constructors : false
Upvotes: -1