FVM Usage Guide
When there are many Flutter projects, you also face the same multi-version environment maintenance issues as Node.js projects. Fortunately, there’s a similar product called FVM. Here’s a simple introduction.
Installation
brew install fvm
Install a Specific Version
fvm install 3.19.2
Note that after installation, fvm list will show that dart and other modules are not installed, but prompt that configuration is needed. This will only install when actually used, i.e., fvm use
.
Use a Specific Version
fvm use
After using, you’ll find that the actual installation begins. After installation is complete, re-executing list will show the dart version information.
Generate FVM Configuration for Project
fvm use *** --save
Note that after save, the project configuration will be generated, and you can use fvm use directly afterwards.
Global Package Version Setting
Sometimes for convenience, you need to set a global version so you don’t have to use fvm commands every time. The specific setting method is as follows.
# Configure PATH in zshrc
export PATH="$HOME/fvm/default/bin:$PATH"
# Set global version
fvm global
# Cancel global version
fvm global -u