fvm icon indicating copy to clipboard operation
fvm copied to clipboard

How should I configure the fvm, I can make sure that the default global version is used under the global and the version specified by the fvmrc is used under the project

Open maxfrees opened this issue 10 months ago • 2 comments

How should I configure the fvm, I can make sure that the default global version is used under the global and the version specified by the fvmrc is used under the project

maxfrees avatar Jan 14 '25 16:01 maxfrees

image image

Now that I have these versions, I want flutter doctor to be the default global stable globally, and if flutter doctor is under project I want it to be the version specified by fvmrc

maxfrees avatar Jan 14 '25 16:01 maxfrees

you can use this https://github.com/leoafarias/fvm/issues/787

quyenvsp avatar Apr 22 '25 02:04 quyenvsp

Great question, @maxfrees! Good news - FVM already does exactly what you want, automatically! No special configuration needed 🎉

How It Works

FVM automatically uses the right version based on where you are:

In a project directory (with .fvmrc):

cd ~/my-project
flutter doctor  # Uses version from .fvmrc

Outside a project (or no .fvmrc):

cd ~
flutter doctor  # Uses global version

Setup

  1. Set your global version:
fvm global stable
  1. Set project versions:
cd ~/my-project
fvm use 3.24.0  # Creates .fvmrc with this version

That's it! FVM handles the rest automatically.

How FVM Resolves Versions

When you run fvm flutter (or flutter if using PATH), FVM checks in this order:

  1. Current directory .fvmrcUse this version
  2. Parent directories .fvmrcUse first one found
  3. Global version (fvm global) → Use this
  4. System Flutter → Last resort

Verify It's Working

Check which version FVM will use:

# In your project
cd ~/my-project
fvm flutter --version  # Should show project version

# Outside project
cd ~
fvm flutter --version  # Should show global version

Check your current setup:

fvm list
# Shows all installed versions
# Global version marked with (global)
# Current project version marked with (active)

No Configuration Needed!

You don't need to configure anything special. As long as you:

  • ✅ Set global with fvm global stable
  • ✅ Set project with fvm use <version> in each project

FVM automatically handles which version to use based on your current directory.

Let me know if you need any clarification!

Closing as this is how FVM works by default.

leoafarias avatar Oct 31 '25 18:10 leoafarias

Question answered - FVM handles this automatically

leoafarias avatar Oct 31 '25 18:10 leoafarias