Home > database >  How to change the path for Flutter SDK - Linux
How to change the path for Flutter SDK - Linux

Time:03-15

So far I have downloaded two different version for the flutter SDK.

One is v2.10.2 and another is v2.5.3.

Currently Flutter is installed in my Linux system with v2.10.2 but the version 2.5.3 is required to run the old flutter project.

So, I required to downgrade the flutter version. So, How can I change the Path for the flutter SDK from terminal ?

I have tried below way :

export PATH="$PATH:/home/jaiminmodi/snap/flutter/common/v2.5.3/flutter_linux_2.5.3-stable/flutter/bin"

But still while checking flutter version its showing 2.10.0

What might be the issue ? Thanks.

CodePudding user response:

I suggest you to use fvm

enter image description here

Now create one folder named aliases.

enter image description here

Create two batch windows files named flutter and flutter253. In my case, it's flutter and flutter1226.

enter image description here

Now edit both files using notepad and add the following line. for the latest version add code (Add your latest flutter version bin path)

@echo off
D:\"Program files"\flutter\bin\flutter %*

for another version add the following code (Add your v2.5.3 flutter version bin path in my case it was v1.22.6 means flutter1226 folder bin path you will be flutter253)

@echo off
D:\"Program files"\flutter1226\bin\flutter %*

Now add aliases folder path in your user and system path environment variables like the following (I highlighted the image)

1. User

enter image description here

2. System

enter image description here

Congrats! it's done now you can you both versions by running commands like

flutter --version and
flutter253 --version in my case it's flutter1226 --version

enter image description here

Now to add it's in your vscode do as the following image

1. go to settings and search dart SDK

enter image description here

2. by clicking the flutter version below you can change the SDK version. enter image description here

  • Related