1.安装 flutter
1.下载安装包(官网或者github):
官网: https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
github: https://github.com/flutter/flutter/releases
2.解压到安装目录:/Users/test/Flutter
3.将Flutter加入环境变量
cd /Users/test/Flutter
执行以下命令
echo 'export PATH=/Users/test/Flutter/flutter/bin:$PATH' >> ~/.bash_profile
echo 'export PUB_HOSTED_URL=https://pub.flutter-io.cn' >> ~/.bash_profile
echo 'export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn' >> ~/.bash_profile
source ~/.bash_profile
上方命令说明:
第1条:把Flutter加入环境变量;
第2、3条:是将Flutter镜像源设置成中国的服务器;
第4条:使配置生效。
2.安装flutter的其它依赖项
环境检查: flutter doctor 这个时间很长
1. 更新flutter: flutter upgrade
2. 安装 brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
3. 安装其他依赖项
flutter doctor
按提示安装,缺啥装啥,最后上一个图:

网友评论