How to update specific flutter SDK channel? - flutter

Currently, i m using flutter 3.3.9 i want to update it to 3.7.3
Any particuler command?
Note : I don't want to affect my current code
Need perment solution for it.

Change channel if you are not in correct channel otherwise go to step 4
Open a terminal or command prompt on your computer.
Check the available Flutter channels by running the command flutter channel.
This will show you the list of available channels and the current channel you are on.
Switch to the desired channel by running the command flutter channel <channel-name>.
For example, to switch to the stable channel, you can run flutter channel stable.
Choose the version.
This is possible now with flutter version. In the console do flutter version to list the versions available. Then choose a version to switch to: flutter version v3.7.3

For these cases, try to use FVM (Flutter Version Management).
fvm install 3.7.3
fvm use 3.7.3
For get more detail here its official website https://fvm.app/
The advantages is you can any cases you can simply go back to your previous flutter version. And also you can work different flutter project with different version

Related

How to move back to flutter stable

I am trying to develop a desktop application and I tried to switch to dev mode using this command flutter channel dev but since then all the flutter command I tried to run are not working. Below sis the error it's showing everytime I run any flutter command.
flutter/version: Operation not permitted
What can I do to solve this?
Easiest way would be to remove the current Flutter installation folder and extract a fresh one with the desired version. You do not have to change anything else, just extract the Flutter SDK in place of the old one and run flutter doctor.
in terminal write flutter channel stable
just run
flutter channel stable && flutter upgrade

How to downgrade flutter from version 2.5.3 to 1.22.6

I have some older projects built on flutter 1.22.6 and now I am working on latest version of flutter but there often comes need when I've to work on previous projects non null safety one's so when I try to downgrade flutter by giving command flutter downgrade 1.22.6 it tells me to downgrade to 2.5.2 and if I try to switch channel and then downgrade it downgrades to 2.5.2 first and then tells there is no version related to 1.22.6. This method used to be working before but now its not working anymore. I don't want to download zip files and then replace again flutter every-time I just want it to be done by cli.
My OS is windows 11
You can use flutter Version Manager fvm its specifically made to control flutter versions plus along with that you can install flutter sidekick as well. I am attaching link for you.
FVM Flutter Sidekick
Since you can no longer downgrade flutter versions, I have found the best way to do this is:
Download desired flutter version
Locate current 'flutter' folder and replace it with the desired version
if you run --flutter version after, it should show the correct version

VSCode, Flutter SDK Version Erroneous?

I believe my Flutter SDK version is being erroneously reported and do not know where the conflict is.
When running flutter doctor it reports Flutter 2.2.3 • channel stable. However, the bottom toolbar in VSCode displays Flutter: 2.0.4.
Is there a reason VSCode and terminal would report the Flutter version differently? And how can I ensure I am running the correct SDK version?
Look into "dart.flutterSdkPath" setting in vscode and change if needed. The problem could be with you having multiple versions of Flutter on the disk and auto-find fails to find the correct one (last version), manually override.
In my case my path( environment variables) of SDK was set wrong check yours first
and if still not worked try running commands
Flutter clean
Flutter upgrade

How to use the flutter downgrade command to switch to an older version of Flutter SDK?

I got the following error when trying to switch to an older version (1.17.4) from my current version (Flutter 1.20.1 • channel stable).
> flutter downgrade
There is no previously recorded version for channel "stable".
Channel "beta" was previously on: 1.17.0-dev.3.1
flutter downgrade is the recommended way for switching versions instead of the deprecated flutter version command. However, there's no documentation I may refer to how it is used.
Another approach to downgrading is to change to the flutter-sdk directory and using git you can checkout a particular tag.
List the available tags with:
git tag
Then switch to a particular one with (e.g.):
git checkout 1.24.0-10.2.pre
(as I had to do today).
Note that this will switch which channel you are on and lock you at that version until you switch back with something like flutter channel dev once you believe the issue you faced is resolved.
in my case , I switched flutter channel master then flutter downgrade v1.22.6 it work
or by using git
git checkout 1.24.0-10.2.pre(any version name)
flutter downgrade only works if you have a previous version of flutter installed from the same channel. It seems like you don't, so please use flutter version v1.17.4.
Find a list of flutter versions here: https://flutter.dev/docs/development/tools/sdk/releases
Check your flutter channel:
flutter channel
Show like this:
Flutter channels:
master
dev
beta
* stable
Change to master:
flutter channel master
Run command:
flutter downgrade v1.22.6
if you want to keep both versions just download a zip of old version and put in the same folder where is a new version and change its name or you can change flutter path

How to use both Flutter stable and dev SDK on the same machine?

I'm working with Flutter to make a Mobile App using the stable Flutter SDK release. But I also want to try Flutter Desktop and Flutter Web that are not part of the Flutter stable channel yet, but are present on the Flutter dev channel.
My question is... How can I try Flutter Desktop and Flutter Web without override the Flutter stable release on my machine?
You'll need to setup alias to switch between different environments easily.
See here a detailed article for that.
I found this Dart package called Flutter Version Management that does exactly what I want.
As the docs says:
Flutter Version Management: A simple cli to manage Flutter SDK versions.
Features:
Configure and use Flutter SDK version per project
Ability to install and cache multiple Flutter SDK Versions
Fast switch between Flutter channels & versions
Dynamic SDK paths for IDE debugging support.
Version FVM config with a project for consistency across teams and CI environments.
Set global Flutter version across projects
https://github.com/leoafarias/fvm
Now I just need to add FVM_HOME/default/bin to the PATH and FVM will take care of everything...
Two solutions
Put the installation files in two different directories one with stable and the other dev and add one of them to the path then you can change the path variable when needed to use the other channel.
Put the flutter repository file in two different directories one with stable and the other with dev then,
add the first installation to the path then add an alias to point to the second installation directory.