To update the Flutter version use the flutter upgrade command:
$ flutter upgrade
To check Flutter version use the command:
$ flutter –version
To Downgrade the Flutter version use the following Steps(from file):
1. Download old(Required) Flutter version.
2. Extract file and paste in the following location:
/home/snap/flutter/common/paste required flutter version.
3. Run flutter doctor and check flutter version.
To Downgrade the Flutter version use the flutter Downgrade command(from terminal):
$ flutter downgrade v3.3.7
This tutorial shows you how to downgrade or upgrade Flutter SDK version using various methods.
If you install Flutter SDK on your computer, you’ll install the latest stable version by default. For some reason, you may want to use an older version. As an example, if the code cannot be run using the latest stable version. On the contrary, sometimes you may want to try new features of a pre-release version. As a result, you need to change the used Flutter SDK version. Previously, Flutter has downgrade
command. Unfortunately, it can’t be used anymore in the newer versions. However, there are some alternatives for changing the SDk version which can be found in this tutorial.
Before changing the version, you can check the current version by using the command below.
flutter –version
Upgrade/Downgrade by Changing Flutter Repository Branch
Changing the used Flutter version can be done by changing the git branch to a specific version. First of all, you have to go to the Flutter SDK directory. The location may vary based on the operating system and how you install it. For example, if you installed the SDK using snap on Ubuntu, by default the directory should be /home/username/snap/flutter/common/flutter
. You can use the command below to check the SDK path.
flutter sdk-path
Then, go to the SDK directory using terminal (or you can use git GUI client too). I assume you’ve installed git on your computer. If you don’t have git installed, you need to install it first. By default, you should be on the stable
branch. You can use the git branch
command to see the list of available branches. Each version has its own branch, so you can just checkout to a specific version using git checkout {branchName}
command. For example, to change the version to 1.22.0, you can use the command below.
git checkout 1.22.0
After that, run any Flutter command such as flutter --version
or flutter doctor
which causes Flutter to perform download and compile for the selected version.
Upgrade/Downgrade by Changing Flutter Channel
Flutter has some channels, which can be seen by using flutter channel command. As for now, the available channels are
- master
- dev
- beta
- stable
Each version can have different versions. For example, the stable channel uses the latest stable version, while the beta channel uses a pre-release version. To change the channel, you can use flutter channel {channelName} command. Below is the example for changing the channel to beta.
flutter channel beta
Just like the previous method, you need to run any Flutter command so that it can download and compile libraries and codes for the version used by the selected channel.
Upgrade/Downgrade by Downloading Specific SDK Version
Another alternative to upgrade or downgrade the Flutter SDK version is by downloading a specific SDK version from the website. Just download a version you want that matches your operating system and extract it to a folder. If the directory is different than the previously used version, you have to change the SDK path of the PATH variable and the IDE that you use.
For updating the PATH variable on Linux, macOS, and Chrome OS, add the export statement below on the $HOME/.bashrc
(Linux/Chrome OS) or $HOME/.zshrc
(macOs) file. If there’s already an existing export statement for Flutter, just replace the existing one.
export PATH=”$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin”
For Windows, open the Edit environment variables for your account GUI window, select User variables and edit the Path entry by appending the full path to the Flutter SDK bin. The Path variable uses ;
as the value separator. If the Path entry doesn’t exist, just create a new entry named Path.
Upgrade Flutter to The Latest Version
To upgrade the SDK to the latest version, you can run the upgrade
command and just wait until the process finishes.
flutter upgrade
The latest version may differ based on the current channel.
Example: flutter version v1.2.1
- This command will use a specific version number. You can have the list of the available version numbers using the flutter version or click here
- After this, run any flutter command such as flutter doctor, and flutter will take care of downloading/compiling everything required to run this version.
- So now, Run the following command to see a list of available versions.
flutter version
Then choose a version you want to switch to by running
flutter version v1.2.1
To undo and revert back to the stable.
flutter channel stable
flutter upgrade
In the Flutter install directory execute:
git checkout v0.1.9
then run
flutter doctor
Conclusion:
Hope you guys are enjoying our guides on Flutter Development.
So in this guide, we learned How to downgrade Flutter SDK.
Drop us your valuable suggestion/feedback to serve you better.
Flutter Agency is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget Guide, Flutter Projects, Code libs and etc.
Flutter Agency is one of the most popular online portals dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge of Flutter.
Also, Explore
Cubit in Flutter
Cubit is a state management. It is a subset of the bloc package that does not given credit to events and instead uses methods to emit new states. It’s a class that stores an observable state, the observation is powered by Streams but in such a friendly way that it is not necessary to know reactive programming.
Read the full article here: https://thekraftors.com/blog/cubit-in-flutter/(opens in a new tab)