1 Windows
(1) 下载 Flutter SDK
- 将安装包zip解压到你想安装Flutter SDK的路径(如:E:)
- 在Flutter安装目录的flutter文件下找到flutter_console.bat,双击运行并启动flutter命令行,接下来,你就可以在Flutter命令行运行flutter命令了。
(2) 更改环境变量
由于在国内访问Flutter有时可能会受到限制,Flutter官方为中国开发者搭建了临时镜像,大家可以将如下环境变量加入到用户环境变量中:
然后重启windows文件资源管理器, 重新加载环境变量
2 Mac
(1) 下载Flutter SDK
解压到/usr/local/bin下
unzip ~/Downloads/flutter_macos_2.8.1-stable.zip -d /usr/local/bin
(2) 更改环境变量
vi ~/.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=$PATH:/usr/local/bin/flutter/bin
export DART_HOME=~/usr/local/bin/flutter/bin/cache/dart-sdk/bin
source ~/.bash_profile
3 Linux
sudo snap install flutter --classic
flutter --version
flutter sdk-path