环境变量配置

Flutter 环境变量配置

配置 ~/.zshrc

配置 Flutter PATH

PATH_OF_FLUTTER_GIT_DIRECTORY 为 Flutter 的安装目录

export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
1

验证 flutter 命令是否可用

$ which flutter # /Users/xx/development/flutter/bin/flutter
1

验证 PATH

输出所有环境变量验证是否成功

$ echo $PATH # /other_path/bin:/User/xx/development/flutter/bin
1

配置 Flutter 资源环境

由于防火墙的原因,国内开发需将资源配置为国内镜像。

export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PUB_HOSTED_URL=https://pub.flutter-io.cn
1
2
Last Updated: 2022/4/20 01:49:37