DEV Community

Ankur Gupta
Ankur Gupta

Posted on

Migrating old Flutter project to the latest version.

Flutter is continuously upgrading, and if you have any years old project, it is necessary to keep your project upgraded with the latest versions.
This comprehensive guide will be just enough for you to upgrade all your projects to the latest versions.

1: Perform flutter upgrade: The first step you need is to make sure you have the latest version of Flutter installed.
Use the command flutter upgrade.

2: Update your SDK versions in your pubspec.yaml file: The next important step is to upgrade your Dart SDK to the latest version. This can be done by visiting your pubspec.yaml file and changing the sdk parameter. This is how the latest SDK version looks like at the time of writing the article:
pubspec.yaml file

3: Update your gradle.build inside the Android folder. This will include changing the kotlin_version specified in line 2 and the gradle version at line 9 if it is manually specified.
Find the available latest Gradle versions at https://gradle.org/releases/
Kotlin versions at: https://kotlinlang.org/docs/releases.html
This is how it looks like:

gradle.build in android folder

4: Upgrade the gradle version in gradle-wrapper.properties inside the android folder.
This will only include changing the distribution_url on line 6.

gradle-wrapper.properties

5: pub upgrade: You all all set. Just upgrade your dependencies to the latest versions by using:
flutter pub upgrade --major-versions
and run the application. Note that according to the dependencies used, you may need to upgrade your code in some cases with the latest changes.

Top comments (0)