Image

flutter

Setup & versions

How to setup Flutter

2 min read
Last update: November 28, 2021

Linux

TODO link

Windows

TODO link

Multiple versions

You need to have Dart

  • For Linux, I offer to add dart to sources.list.d dart.dev/get-dart
  • For Windows, I offer to use scoop to install dart scoop.sh
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' ; sudo apt-get update ; sudo apt-get install dart ; echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile ; source ~/.profile
sudo scoop install dart

Install globally FVM with pub

pub global activate fvm

You need to add FVM path to .profile or PATH on Windows and fvm will be available (on Windows, you will need to restart your terminal).

echo 'export PATH="$PATH":"$HOME/.pub-cache/bin"' >> ~/.profile ; source ~/.profile
# This PowerShell command will add `C:\Users\USERNAME\AppData\Local\Pub\Cache\bin` to user `Path` in Windows environement variables. You have to restart your current terminal.
$INCLUDE = "C:\Users\$env:UserName\AppData\Local\Pub\Cache\bin" ; $OLDPATH = [System.Environment]::GetEnvironmentVariable('PATH','user') ; $NEWPATH = "$OLDPATH;$INCLUDE" ; [Environment]::SetEnvironmentVariable("PATH", "$NEWPATH", "user")

List Flutter releases

fvm releases

Install any version

fvm install 1.22.6

List all installed versions

fvm list

On the root of a project, execute fvm use to setup FVM Flutter version, this will create .fvm directory on the root of project and any fvm command will use version setup (if you install it).

fvm use 1.22.6 # OR use just 'fvm use' to select manually

Example of fvm_config.json

.fvm/fvm_config.json
{
  "flutterSdkVersion": "1.22.6"
}

Use FVM like proxy for flutter commands

fvm flutter run