4

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.

Jay Mungara
  • 6,663
  • 2
  • 27
  • 49
  • 2
    install two versions in different locations and simply switch `PATH` env variable – pskink May 02 '20 at 08:13
  • Let say i open a project in which i am currently on stable channel. Then if i want to move to master channel what should i do? Also in projects settings which flutter sdk should i point? Flutter sdk which is in my stable folder or flutter sdk which is in my master channel? You can briefly answer your question as well. – Jay Mungara May 02 '20 at 08:20
  • you need to install two flutter versions on different physical locations as described here: https://flutter.dev/docs/get-started/install/windows#get-the-flutter-sdk and update your `PATH` to switch to the version you want to use, more here: https://flutter.dev/docs/get-started/install/windows#update-your-path – pskink May 02 '20 at 08:30
  • 1
    use FVM the flutter version manager as @Karol Lisiewicz recommended – Yadu May 02 '20 at 09:02

2 Answers2

9

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.

Karol Lisiewicz
  • 654
  • 5
  • 15
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)
ArRo
  • 151
  • 1
  • 6