先用git下载stable分支的Flutter,使用git是为了方便后面直接升级Flutter
命令如下
git clone https://github.com/flutter/flutter.git -b stable
使用ssh减少不稳定的概率
git clone git@github.com:flutter/flutter.git -b stable
然后再配置服务器镜像环境变量,防止有时pub命令连接不了服务器
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
将Flutter目录放入环境变量中,在命令行执行Flutter doctor,根据提示进行操作
过程中有可能出现HTTP host https://maven.google.com/ is not reachable问题
参考 解决HTTP host https://maven.google.com/ is not reachable 解决