官方教程mac下安装Flutter需要到github下载flutter安装包,但是国内网络环境限制必须通过工具下载,

安装

安装稳定版本

brew tap MiderWong/flutter
brew install flutter

安装测试版本

brew tap MiderWong/flutter
brew install --devel flutter

升级

升级稳定版本

brew reinstall flutter

升级测试版本

brew reinstall --devel flutter

切换版本

切换稳定版本到测试版本

brew uninstall --force flutter
rm -rf "$(brew --cache)/flutter--git"
brew install --devel flutter

切换测试版本到稳定版本

brew uninstall --force flutter
rm -rf "$(brew --cache)/flutter--git"
brew install flutter

卸载

brew uninstall --force flutter
rm -rf "$(brew --cache)/flutter--git"
brew untap MiderWong/flutter

安装状态

Flutter安装目录/usr/local/opt/flutter
dart-sdk安装目录/usr/local/opt/flutter/bin/cache/dart-sdk
国内用户安装完成后设置PUB_HOSTED_URLFLUTTER_STORAGE_BASE_URL

flutter中国镜像

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

上海交通大学镜像

export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn
export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn