fvm 管理多 flutter 版本
安装
$ brew tap leoafarias/fvm
$ brew install fvm
卸载
$ brew uninstall fvm
$ brew untap leoafarias/fvm
配置
# 设置 flutter 存储路径
# 命令: fvm config --cache-path <CACHE_PATH>
$ fvm config --cache-path /Users/chenbing/local/fvm/versions
使用
# 在flutter命令前添加fvm即可
$ fvm flutter run
命令行指定版本
# 在项目里使用 flutter 3.0.5 版本
$ fvm use 3.0.5
或者配置文件指定
在 .vscode 文件夹下创建 settings.json,填写如下配置:
{
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// Remove .fvm files from search
"search.exclude": {
"**/.fvm": true
},
// Remove from file watching
"files.watcherExclude": {
"**/.fvm": true
}
}
gitignore 添加忽略
# FVM will create a relative symlink in your project
.fvm/flutter_sdk