现象:

在MacOS Catalina 10.15中通过命令行 “flutter create flutter_text“创建flutter项目出现:

Running "flutter pub get" in xx    (This is taking an unexpectedly long time

或者是:通过Android Studio创建flutter工程很慢
或者是:zsh: command not found: flutter问题

原因

从 macOS Catalina 版开始,Mac 将使用 zsh 作为默认登录 Shell 和交互式 Shell,终端启动时 ~/.bash_profile 将不会被加载,加载的是~/.zshrc文件

解决办法

将~/.bash_profile中的:

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

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

export PATH=/Users/xx/xxx/flutter/bin:$PATH

复制拷贝到~/.zshrc中,再使用source命令重新加载一下

source ~/.zshrc

注:
Flutter官网文档也有提到:https://book.flutterchina.club/chapter1/install_flutter.html
“在macOS上搭建Flutter开发环境” -> “更新环境变量” 部分中

Flutter MacOS 10.15 Running “flutter pub get”问题