Add auto-Const in flutter in Android Studio
123
- Go to
File
->Settings
->Languages & Frameworks
->Flutter
- Under Editor Section check the
Format code on save
andOrganize imports on save
options and Apply changes.
Author by
Abdul raheem
Updated on January 04, 2023Comments
-
Abdul raheem over 1 year
I have switched from vsCode to android studio for my flutter project as I think I feel comfortable reading the code In android studio
Though in vs code when i save the file the file gets formatted and it adds
const
keyword wherever my widget needed itPROBLEM
In android studio neither the code gets formatted nor it adds const keyword wherever its needed
Please help with the 2 problem
-
Abdul raheem about 2 yearsAlso is there not any way that android studio add const keyword where it is needed, as like vs code does... i will be grateful for that... THANK YOU FOR YOUR HELP & TIME
-
Dulaj Nadawa about 2 yearsAs my knowledge, there is no way to automatically add the const keywords in the android studio.
-
Dulaj Nadawa about 2 yearsBut you can use
dart fix --apply
command to fix all analyser issues underlined in the yellow color. -
Abdul raheem about 2 yearsYes thank you, though for now it adds const wherever it needs by executing the command you shared💖
-
Dulaj Nadawa about 2 yearsHappy to help you! If you found this answer correct, you can mark the answer as correct.