How to setup Flutter version manager vscode ubuntu?

Flutter version manager

fvm is a command line utility that helps us to build flutter projects in different versions

Install using dart using apt-get
Perform the following one-time setup:
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'

Install Dart

sudo apt-get update


sudo apt-get install dart

Activate Fvm:

activate fvm globally

dart pub global activate fvm

set this path in .bachrc file

export PATH="$PATH":"$HOME/.pub-cache/bin"

more info about other commands with fvm

user:~$ fvm help
Flutter Version Management: A cli to manage Flutter SDK versions.

Usage: fvm <command> [arguments]

Global options:
-h, --help       Print this usage information.
    --verbose    Print verbose output.

Available commands:
  config     Set configuration for FVM
  flutter    Proxies Flutter Commands
  install    Installs Flutter SDK Version
  list       Lists installed Flutter SDK Version
  releases   Lists Flutter SDK releases.
  remove     Removes Flutter SDK Version
  use        Which Flutter SDK Version you would like to use
  version    Prints the currently-installed version of FVM

Run "fvm help <command>" for more information about a command.

Install a SDK Version

Install a proper version of flutter using fvm

user:~$ ​fvm install 2.0.1
Installing version: 2.0.1
Cloning into '/home/user/fvm/versions/2.0.1'...
remote: Enumerating objects: 286607, done.        
remote: Total 286607 (delta 0), reused 0 (delta 0), pack-reused 286607        
Receiving objects: 100% (286607/286607), 131.78 MiB | 5.59 MiB/s, done.
Resolving deltas: 100% (220781/220781), done.
Version installed: 2.0.1
Downloading Dart SDK from Flutter engine 40441def692f444660a11e20fac37af9050245ab...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  193M  100  193M    0     0  5265k      0  0:00:37  0:00:37 --:--:-- 5464k
Building flutter tool...
Flutter 2.0.1 • channel unknown • unknown source
Framework • revision c5a4b4029c (3 weeks ago) • 2021-03-04 09:47:48 -0800
Engine • revision 40441def69
Tools • Dart 2.12.0

Set current flutter versions

fvm use <version>

This command is for listing multiple version of flutter

user:~$ fvm list
Versions path:  /home/user/fvm/versions
stable
2.0.1
1.22.6

 

Configure your ide

create a directory called .vscode and add a file settings.js and paste below code

{
  "dart.flutterSdkPaths": ["/home/user/fvm/versions"]
}

 

Additional Resources:-

https://dart.dev/get-dart

https://pub.flutter-io.cn/packages/fvm

Leave a Comment