Skip to main content

Featured

How to Upgrade Flutter Version and Project #3

Updating your Flutter project ensures better performance, security, and access to the latest features. In this guide, I'll walk you through upgrading Flutter and updating your project dependencies.




Steps to Update Flutter Project

1. Check Your Current Flutter Version

Before upgrading, check which version of Flutter is currently installed by running:

flutter --version

2. Upgrade Flutter to the Latest Version

To upgrade Flutter, use the following command:

flutter upgrade

This command fetches the latest stable version and updates the Flutter SDK.

3. Update Dependencies in 

After upgrading Flutter, update your project's dependencies:

flutter pub upgrade

You may also manually update dependency versions in the pubspec.yaml file.

4. Update Gradle and Kotlin for Android

If you're developing for Android, update Gradle and Kotlin to avoid compatibility issues.

A] Update Gradle Plugin Version

Navigate to android/settings.gradle and update the plugin versions:

plugins {
    id "com.android.application" version "8.9.0" apply false
    id "org.jetbrains.kotlin.android" version "2.1.20-RC3" apply false
}

B] Update Gradle Wrapper

Edit android/gradle/wrapper/gradle-wrapper.properties and update the distributionUrl:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip

Final Step: Clean and Rebuild the Project

After making all the updates, clean and rebuild the project:

flutter clean
flutter pub get

This removes cached files and fetches the latest dependencies.

Conclusion

Upgrading Flutter and your project ensures compatibility with new features and improves performance. Always test your app thoroughly after upgrading to catch any breaking changes.

💡 Tip: If you face issues, refer to the Flutter documentation or community forums for troubleshooting.

Happy coding! 🚀

Comments

Popular Posts