How to Change the Project Name In Flutter

How to Change the Project Name In Flutter?

Users can create a flutter project using the command flutter create a name so what if a user wants to change the project once the new project is already been created. So in this article, we will take a look at how to change the project name in flutter.

In this blog post, we’ll walk you through the process of changing the project name in Flutter. Whether you’re rebranding your app or simply want to give it a new identity, this comprehensive guide will provide you with the steps and considerations to successfully rename your Flutter project. We’ll explore different aspects of the renaming process, including adjusting the project structure, updating dependencies, and handling potential issues that may arise during the renaming process. With practical examples and clear instructions, we’ll equip you with the knowledge and tools to confidently change the project name without affecting your app’s functionality.

Know How to Change the Project Name In Flutter?

That depends on what you are trying to achieve.

If you want to change the name of the app which is displayed in the menu of the mobile phone together with the app icon, you have to change the android:label in the android/app/src/main/AndroidManifest.xml (Code Sample 1) and the CFBundleName in the ios/Runner/Info.plist (Code Sample 2).

The last time I did this it took me ages to find out, why the name of the app was not changed in the list of currently running apps on Android.

For that, you also need to change the title of your MaterialApp (Code Sample 3).

For renaming it everywhere I would suggest using search and replace in the project.

If you do this, you have to choose a name without spaces or special characters.

So project name ‘new project’ in the pubspec.yaml for example will break the build.

Code Sample 1:
<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="New Name"
    android:icon="@mipmap/ic_launcher">
Code Sample 2:
<key>CFBundleName</key>
<string>New Name</string>
Code Sample 3:
return new MaterialApp(
  title: 'New Name'
  ...);

So if you want to change the project name, simply change it in all these files.

  • build.gradle (app)
  • AndroidManifest.xml
  • MainActivity.java

Rebuild your app and you should be good to go.

If you are using Android Studio, follow these steps:

  • Right-click your project in the Project window (Alt+1 to show).
  • Click Refactor > Rename.
  • Enter a new name.

So This will rename the project’s name on all required places except in the test directory.

Steps to rename your project:
  1. Use VSCode’s any other editor’s search and replace across the entire project feature. But always turn on the match cases for vscode: located on the right side.
  2. You have to do this two times as for the first you have to replace com.orgname.currentname with com.orgname.newname then
  3. currentname with newname
  4. Rename the folders inside /android/app/src/main/kotlin/com/orgname/currentname to new /android/app/src/main/kotlin/com/orgname/newname.
  5. If you’re using only Java with flutter then just replace the kotlin with java
  6. Rename the currentname.iml of your root project folder to newname.iml

Conclusion:

Thanks for reading!! Hope you have learned better!!

So in this article, we have been through how to change the project name in flutter.

Do not forget to drop your valuable suggestions/feedback. We would love to assist you.

FlutterAgency.com is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget GuideFlutter ProjectsCode libs and etc.

FlutterAgency.com is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.

Nirali Patel

Written by Nirali Patel

Nirali Patel is a dedicated Flutter developer with over two years of experience, specializing in creating seamless mobile applications using Dart. With a passion for crafting user-centric solutions, Nirali combines technical proficiency with innovative thinking to push the boundaries of mobile app development.

Leave a comment

Your email address will not be published. Required fields are marked *


Discuss Your Project

Connect with Flutter Agency's proficient skilled team for your app development projects across different technologies. We'd love to hear from you! Fill out the form below to discuss your project.

Have Project For Us

Get in Touch

"*" indicates required fields

ready to get started?

Fill out the form below and we will be in touch soon!

"*" indicates required fields