Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to refactor file names in Android Studio in Dart or Flutter project?

When using android studio's refactoring tool refactoring -> rename to change file names or file paths it does not change the corresponding imports.

In Android projects this happens automatically, but when in a flutter project name changes of files breaks all classes importing the renamed file.

Is it possible to fix this?

like image 988
Joel Broström Avatar asked Dec 15 '25 18:12

Joel Broström


2 Answers

I found the source of my problem. Search for references and Search in comments and strings were unchecked. Checking search for references solved the issue.

enter image description here

like image 54
Joel Broström Avatar answered Dec 17 '25 13:12

Joel Broström


To rename files in Android Studio and changing the references of that fil in the code use Refactor > Rename on the file itself.

like image 35
Muldec Avatar answered Dec 17 '25 12:12

Muldec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!