how to change package name in flutter
how to change package name in flutter

This package library will make it very easy and fast to change flutter android package name.

How to use flutter change package name

So, Let’s begin with how to alter android package name in your flutter application.

1. Adding dev dependencies

Open <flutter project> / pubspec.yaml under this file look for dev_dependencies : section, just below it add change app package name, as shown in below screenshot.

dev_dependencies:
  change_app_package_name: ^0.1.2  
alter package name

2. Updating Flutter pub get

Once you have added any new dependencies in pubspec.yaml file, you always need to update it,

Then, to do that you need to run a commant i.e.

flutter pub get

Then, this commend will download the latest dependencies library files in your flutter project External Libraries, in our case it change_app_package_name.

3. Running a command to alter package name

You just need to run a command that will alter package name of your flutter android module.

See down of your IDE(Android Studio/VsCode) you may see terminal open it and just paste below cmd that will automatically change package name of your project.

flutter pub run change_app_package_name:main com.new.package.name

What this library does:

  • Update AndroidManifest.xml file release,debug & profile.
  • Update build.gradle file.
  • Update Activity’s file in your android module, Both java & Kotlin is supported.
  • Moves MainActivity file to new package directory.
  • Delete old package directory.

Video Tutorial

Recommended post

How to change Flutter App Launcher Icon.

How to install Flutter Plugin in android Studio.