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.
These wrappers need a POSIX shebang and "$@". A one-line fvm dart ${@:1} file has no shebang, so Ubuntu runs it with dash, and global packages such as melos fail with Bad substitution.
On Mac
sudo tee /usr/local/bin/flutter > /dev/null << 'EOF'
#!/bin/sh
exec fvm flutter "$@"
EOF
sudo chmod +x /usr/local/bin/flutter
sudo tee /usr/local/bin/dart > /dev/null << 'EOF'
#!/bin/sh
exec fvm dart "$@"
EOF
sudo chmod +x /usr/local/bin/dartOn Linux
mkdir -p "$HOME/.local/bin"
cat > "$HOME/.local/bin/flutter" << 'EOF'
#!/bin/sh
exec fvm flutter "$@"
EOF
chmod +x "$HOME/.local/bin/flutter"
cat > "$HOME/.local/bin/dart" << 'EOF'
#!/bin/sh
exec fvm dart "$@"
EOF
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