Flutter 命令慢的解决办法

1、安装Flutter慢的方法,

Flutter官方给出了在中国能够愉快使用的方法 — Flutter中国镜像

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
git clone -b dev https://github.com/flutter/flutter.git
export PATH="$PWD/flutter/bin:$PATH"
cd ./flutter
flutter doctor

2、安装第三方包慢的解决方法

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

上述export都是临时环境变量,一劳永逸的方法是在~/.bash_profile添加

export PATH=xxx/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

添加完以后使用source ~/.bash_profile来更新刚配置的环境变量。xxx是flutter的安装路径

3、Waiting for another flutter command to release the startup lock解决方法

删除flutter的安装目录/bin/cache/lockfile文件,然后重启开发工具。