To rename a Flutter project, you need to follow the below steps:
- Close the project in your IDE (such as VS Code or Android Studio).
- Go to the root directory of the project in your file explorer.
- Rename the main project folder to the desired name.
- Open the renamed project folder.
- Open the
pubspec.yaml
file. - Change the
name
field to the desired name. Make sure to use lowercase letters, numbers, and underscores only, and no spaces. - Save the
pubspec.yaml
file. - Reopen the project in your IDE.
- Run
flutter pub get
command in the terminal to update dependencies. - Congratulations! Your Flutter project is now renamed.
Here’s an example:
- You have a Flutter project called
my_flutter_app
. - You want to rename it to
awesome_app
. - Close the project in your IDE.
- Rename the
my_flutter_app
folder toawesome_app
. - Open the
awesome_app
folder. - Open the
pubspec.yaml
file. - Change the
name
field toawesome_app
. - Save the
pubspec.yaml
file. - Reopen the project in your IDE.
- Run
flutter pub get
command in the terminal. - Done! Your project is now renamed to
awesome_app
.