Flutter - How to switch flutter channel without downloading flutter & dart sdk every time

4,650

Solution 1

You may have a look on Flutter FVM. This tool allows you to manage multiple channels and releases, and caches these versions locally, so you don't have to wait for a full setup every time you want to switch versions.

Solution 2

Solution for Linux(possibly MacOS)

  1. Download pure flutter
  2. Unzip it.
  3. Change the name to "flutter-stable"
  4. Make a copy of this folder.
  5. Change the name of the copy to "flutter-web" (for example).
  6. Open the .bashrc file in your home folder.
  7. Add two lines at the end: alias flutter = "{your directory path}/flutter-stable/flutter" alias flutter-web = "{your path to folder}/flutter-web/flutter"
  8. Restart the computer (or log out and log back in).
  9. Enter in the terminal "flutter doctor -v" and "flutter-web doctor -v" (to download the necessary files)
  10. Enter "flutter-web channel" in the terminal to find out the current branch (marked with a star)
  11. In order to change the branch, enter the "flutter-web channel master" in the terminal (instead of the master, you can choose any other)
  12. Enter "flutter-web upgrade" in the terminal to update the branch.

Done. If you need a stable version, then use flutter (flutter pub get), if for the web, then flutter-web (flutter-web pub get)

Ps if you already have a stable version, then:

  • skip point 3 and 4. (you don't need to make copies, just download a clean flutter sdk, unpack, rename it, and put it next to the existing one)
  • remove the path to the flutter sdk from the environment so that there is no name conflict (requires a reboot)
Share:
4,650
Jay Mungara
Author by

Jay Mungara

A passionate app developer. I'm learning new programming things and exploring coding fundamentals to grow my computational skills. I'm 63rd person to earn flutter technology silver badge I'm 71st person to earn flutter technology bronze badge. I'm 125th person to earn dart technology bronze badge.

Updated on December 20, 2022

Comments

  • Jay Mungara
    Jay Mungara over 1 year

    Currently i was trying on flutter web for which i needed to work on flutter master channel. But, then i needed to work on my other projects. On them i am working on flutter stable channel.

    But, every time i switch my flutter channel using the command "flutter channel stable" or "flutter channel master", It keeps re-downloading sdk and other tools every time.

    Currently, i have downloaded stable flutter sdk and stable dart sdk.

    I have moved them in a "FlutterSDK" folder with two other folders "stable" & "master" in it. Both folders contains the stable flutter & dart sdk.

    But, it keeps re-downloading the resources. What am i doing wrong ?

    Can anyone help with this?

    Thanks.