3

I've a flutter project in Visual Studio Code uploaded in git too. Now I want to create a new project with different package and AppName by changing existing one. How can I do that? hope you guys understand what I am talking about. Thanks in advance

Abdul Qadir
  • 492
  • 4
  • 13

1 Answers1

6

You can use rename package to rename your appname and packagename and bundle id and everything. Just install it globaly so you can use it everywhere.

flutter pub global activate rename

Then navigate to your project directory and change the bundleId (package name) and appname:

flutter pub global run rename --bundleId com.onatcipli.networkUpp
flutter pub global run rename --appname "Network Upp"

You can also make a copy of your project before doing all this, so you can have both versions.

Changing the app icon

If you want to change the app icon as well, use this method after renaming:

https://stackoverflow.com/a/52829977/5423747

What I do

Usually I have to remake same package for different organizations. I have a main project in git is stable branch, then I make new branch from stable branch and repeat the methods above.

Arash Mohammadi
  • 1,313
  • 1
  • 13
  • 28
  • would be change the package name too? – Abdul Qadir Feb 01 '21 at 08:19
  • The bundleId is same as the package name. (the first line) – Arash Mohammadi Feb 01 '21 at 09:07
  • _then I make new branch from stable branch and repeat the methods above_ -just wanted to ask, isn't it better to create a new repository, rather than creating lots of new branches? – Muhammad Faisal Jan 24 '23 at 10:28
  • @MuhammadFaisal My app is being used by more than 30 organizations, managing repositories would be really hard. And for every update, I don't have to update each repository one by one. In each branch I just change the API base URL and I get the organization info (like the name, icon, color, auth data and ... ) from the (API base URL + /config). – Arash Mohammadi Jan 25 '23 at 07:50
  • Oh i see.. In that case, that decision is great, but on my case every project have different request and demand, even though the program itself have its base code – Muhammad Faisal Jan 26 '23 at 02:43
  • 1
    @MuhammadFaisal Then I'd suggest making your base code a package/sdk so the new features and updates would apply on all your projects. – Arash Mohammadi Jan 26 '23 at 16:41
  • 1
    Thanks for the suggestion, but the program itself is a full custom, so it's possible that the package/sdk maybe will also be full customized too, soo yeah, i think i will customize it only to changes requested.. – Muhammad Faisal Jan 27 '23 at 03:48