1.本地安装,安装fvm的坑
本人电脑使用windows ,安装fvm则一般使用choco安装,那么首先需要安装choco,打开powershell/或者cmd运行以下命令:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco安装成功后 通过choco install fvm可安装fvm
fvm安装成功后,通过命令行中使用fvm命令对flutter 版本进行控制
fvm安装后需要对flutter 进行管理 使用flutter global xxxx 指定全局的flutter版本,运行这个命令后,会自动在fvm/versions统计生成一个default目录,该目录可以用来配置默认的flutter版本,这样才能全局使用flutter 命令操作,否则会提示 flutter 不是一个命令之类的提示
2.fvm管理flutter版本
进入对应项目目录中,运行fvm use xxx切换flutter版本 ,但这时遇到另一个坑(https://storage.flutter-io.cn/ 镜像无法使用的问题 ),该坑最好在配置PUB_HOSTED_URL和FLUTTER_STORAGE_BASE_URL两个配置时将对应地址改成国内其他镜像环境