How do I upgrade my Flutter from 2.0 to 3.0?

27 June 2023 / By Arham Technosoft

Updating the app version is a crucial aspect of app development, as it allows you to release new features, improvements, and bug fixes to your users. In a Flutter project, updating the app version involves making changes to the iOS and Android configurations. This article will provide a step-by-step guide on how to update the app version for both iOS and Android platforms using command-line instructions in Flutter.

Updating App Version in iOS

Updating the app version in iOS requires modifying the Info.plist file using command-line instructions. Follow the steps below:

Step 1: Open Terminal and navigate to the root directory of your Flutter project.

Step 2: Run the following command to open the iOS project in Xcode:

open ios/Runner.xcworkspace

Step 3: In Xcode, locate the “Info.plist” file under the “Runner” folder.

Step 4: Update the app version by executing the following command:

/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString x.x.x" Runner/Info.plist

Replace “x.x.x” with your desired app version.

Step 5: Optionally, update the build version by executing the following command:

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion x" Runner/Info.plist

Replace “x” with your desired build version.

Step 6
: Save and close Xcode.

Updating App Version in Android

Updating the app version in Android involves modifying the build.gradle file using command-line instructions. Follow the steps below:

Step 1: Open Terminal and navigate to the root directory of your Flutter project.

Step 2: Run the following command to open the Android project in Android Studio:

open android

Step 3: In your preferred code editor, locate the “build.gradle” file under the “app” folder.

Step 4: Update the app version by executing the following command:

sed -i '' 's/versionName ".*"/versionName "x.x.x"/' app/build.gradle

Replace “x.x.x” with your desired app version.

Step 5: Optionally, update the build version by executing the following command:

sed -i '' 's/versionCode .*$/versionCode x/' app/build.gradle

Replace “x” with your desired build version.

Step 6: Save the changes.

Rebuilding and Deploying the Updated App:

Once you have updated the app version for both iOS and Android, you need to rebuild and deploy your Flutter app. Follow these steps:

Rebuilding for iOS:

Step 1: In Terminal, navigate to the root directory of your Flutter project.

Step 2: Run the following command to build the iOS app:

flutter build ios

Step 3: Once the build process completes, you can deploy the updated app version using Xcode or by archiving and distributing the app.

Rebuilding for Android:

Step 1: In Terminal, navigate to the root directory of your Flutter project.

Step 2: Run the following command to build the Android app:

flutter build apk

or

flutter build appbundle

Choose either “apk” or “appbundle” depending on your deployment needs.

Step 3: Once the build process completes, you can deploy the updated app version by installing the APK on devices or publishing the App Bundle to the Google Play Store.

Conclusion:

Updating the app version is an important step when migrating from Flutter 2 to Flutter 3. By following the provided steps to update the app version in both iOS and Android, you can ensure that your users are aware of the changes and improvements in the upgraded Flutter 3 version. Remember to thoroughly test the app after the update and leverage the new features and enhancements offered by Flutter 3.

About The Author

Arham Technosoft

Leave a Comment

*Please complete all fields correctly