Flutter: How upgrade the version code for play store or app store

Updating Version in pubspec.yaml:

In your Flutter project, the version is specified in the pubspec.yaml file. Locate the version field, which looks like this:

version: A.B.C+X
  • A.B.C: Represents the versionName, such as 1.0.0.
  • X: Represents the versionCode (for Android) or CFBundleVersion (for iOS), such as 1, 2, 3, etc.

Update the version as needed, following semantic versioning conventions.

For Android:

  1. Open your terminal and run the following command:
    flutter build apk
  2. This command updates the versionName and versionCode in the local.properties file, which is later used during the build process.

For iOS:

  1. After updating the version in pubspec.yaml, run the following command in your terminal:
    flutter build ipa
  2. This command ensures the changes are applied to CFBundleShortVersionString and CFBundleVersion in the Info.plist file.

Why It Matters:

Executing these commands is crucial to synchronize version information across different configuration files. This step ensures a consistent versioning experience on both Android and iOS platforms.

Conclusion:

Updating the version in your Flutter project goes beyond modifying pubspec.yaml. Executing Flutter build commands is essential for propagating version changes to platform-specific files. By following these steps, you ensure that the version information aligns correctly when building your app for distribution on the Play Store or App Store.

I hope this provides a clearer set of instructions for updating the version in your Flutter project. If you have any further questions or need additional clarification, feel free to ask.

Leave a Comment

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

Scroll to Top