How to rename dart file in VSCode?

Viewed 1498

Working with dart/flutter in VSCode (1.38.1). I want to rename a class, so want to rename its dart file. I right-click on the filename in VSCode and rename the dart file. I then change all its imports to reflect the name, but when I run Debug, I get the error

path\old_name.dart were declared as an inputs, but did not exist. Check the definition of target:kernel_snapshot for errors

What more does one have to do to rename a file in VSCode/dart?

3 Answers

In your project directory, type in the terminal

flutter clean

Then run again

Just delete .dart_tool folder, and rerun.

To rename you class just put the cursor on then class name and press F2. Then type the new name and it would be done.

Related