Running Flutter
FVM provides proxy commands to run Flutter and Dart with the correct SDK version for your project.
Proxy Commands
Flutter
fvm flutter <command>Dart
fvm dart <command>Tip: Create aliases for convenience:
alias f="fvm flutter"
alias d="fvm dart"SDK Resolution Order
When you run fvm flutter or fvm dart, FVM looks for the SDK in this order:
- Project
.fvmrcfile - Ancestor directory
.fvmrc - Global version (
fvm global) - System PATH Flutter
Direct SDK Access
You can also call the SDK directly using the symlink:
.fvm/flutter_sdk/bin/flutter runSpawn Command
Run commands with any installed Flutter version:
fvm spawn 3.19.0 doctorIf you wish to reroute flutter and dart calls to FVM, i.e., ensure that running flutter on the terminal internally runs fvm flutter, then you could run the below commands.
On Mac
sudo echo 'fvm flutter ${@:1}' > "/usr/local/bin/flutter" && sudo chmod +x /usr/local/bin/flutter
sudo echo 'fvm dart ${@:1}' > "/usr/local/bin/dart" && sudo chmod +x /usr/local/bin/dartOn Linux
echo 'fvm flutter ${@:1}' > "$HOME/.local/bin/flutter" && chmod +x "$HOME/.local/bin/flutter"
echo 'fvm dart ${@:1}' > "$HOME/.local/bin/dart" && chmod +x "$HOME/.local/bin/dart"If you've installed flutter/dart using native package managers, the binaries might conflict with these new shortcuts, so consider deleting the existing ones and taking a backup for easier restoration.
If you wish to remove these reroutes, just delete the corresponding files as shown below:
On Mac
sudo rm /usr/local/bin/flutter
sudo rm /usr/local/bin/dartOn Linux
rm "$HOME/.local/bin/flutter"
rm "$HOME/.local/bin/dart"Spawn Command
Spawns a command on any installed Flutter SDK.
fvm spawn {version}Examples
The following will run flutter analyze on the master channel:
fvm spawn master analyze