安装
brew install fvm
命令
Sets Flutter SDK Version you would like to use in a project. If version does not exist it will ask if you want to install.
设置您要在项目中使用的 Flutter SDK 版本。如果版本不存在,它将询问您是否要安装。
Usage:
fvm use {version}
Option:
-h, --help Print this usage information.
-f, --force Skips Flutter project checks.
-p, --pin Pins latest release channel instead of channel itself.
--flavor Sets version for a project flavor
If you are starting a new project and plan on using fvm flutter create you wil have to use the --force flag
如果你正在开始一个新项目并计划使用 fvm flutter create ,你将不得不使用 --force 标志
Install#
Installs Flutter SDK Version. Gives you the ability to install Flutter releases or channels.
安装 Flutter SDK 版本。使您能够安装 Flutter 版本或频道。
Usage:
fvm install - # Installs version found in project config
fvm install {version} - # Installs specific version
Option:
-h, --help Print this usage information.
-s, --skip-setup Skips Flutter setup after install
Remove#
Removes Flutter SDK Version. Will impact any projects that depend on that version of the SDK.
移除 Flutter SDK 版本。将影响任何依赖该版本 SDK 的项目。
Usage:
fvm remove {version}
Option:
-h, --help Print this usage information.
--force Skips version global check.
List#
Lists installed Flutter SDK Versions. Will also print the cache directory used by FVM.
列出已安装的 Flutter SDK 版本。还将打印 FVM 使用的缓存目录。
Usage:
fvm list
Option:
-h, --help Print this usage information.
Releases#
View all Flutter SDK releases available for install.
查看所有可供安装的 Flutter SDK 版本。
Usage:
fvm releases
Option:
-h, --help Print this usage information.
Doctor#
Shows information about environment, and project configuration.
显示有关环境和项目配置的信息。
Usage:
fvm doctor
Option:
-h, --help Print this usage information.
Android Studio 的配置
- Go to
Languages & Frameworks > Flutter
or search for Flutter and change Flutter SDK path.
转到Languages & Frameworks > Flutter
或搜索 Flutter 并更改 Flutter SDK 路径。 - Copy the *absolute* path of fvm symbolic link in your root project directory. Example:
/absolute-project-path/.fvm/flutter_sdk
在你的项目根目录中复制 fvm 符号链接的绝对路径。示例:/absolute-project-path/.fvm/flutter_sdk
- Apply the changes. 应用更改。
- Restart Android Studio to see the new settings applied.
重新启动 Android Studio 以查看应用的新设置。
IMPORTANT
For Android Studio to detect the dynamic change of SDKs, the installed SDK must have finished setup.
为了让 Android Studio 检测到 SDK 的动态变化,安装的 SDK 必须已经完成设置。
Using fvm install <VERSION>
will ensure that setup during install.
使用 fvm install <VERSION>
将确保在安装过程中进行设置。
If you have installed through another command and setup was not completed. You can finish by just running fvm flutter --version
如果您通过另一个命令安装并且设置未完成。您只需运行 fvm flutter --version
即可完成
Android Studio might take a few seconds to detect the dynamic SDK change.
Android Studio 可能需要几秒钟来检测动态 SDK 更改。
If you want to ignore the Flutter SDK root directory within Android Studio you can add the following to .idea/workspace.xml
.
如果你想忽略 Android Studio 中的 Flutter SDK 根目录,你可以将以下内容添加到 .idea/workspace.xml
。
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$/.fvm/flutter_sdk" />
</ignored-roots>
</component>
If that doesn't work, go to Android Studio -> Preferences -> Editor -> File Types -> Ignored Files and Folders and add flutter_sdk
: