pub get一直卡在Resolving dependencies...

添加pubspec.yaml配置
pub get一直卡在Resolving dependencies…
原因:訪問國外下載很慢,我們需要配置鏡像:

解決方法:

官方提供的國內鏡像:

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

上海交通大學提供的國內鏡像:

export FLUTTER_STORAGE_BASE_URL=https://mirrors.sjtug.sjtu.edu.cn/
export PUB_HOSTED_URL=https://dart-pub.mirrors.sjtug.sjtu.edu.cn/

清華大學鏡像

臨時使用 TUNA 的鏡像來安裝依賴:
$ PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" pub get # pub
$ PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub/" flutter packages get # flutter
若希望長期使用 TUNA 鏡像:
$ echo 'export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"' >> ~/.bashrc

window配置鏡像方法:

在這裏插入圖片描述
在這裏插入圖片描述

Linux 或 Mac配置方法:

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

親測配置後完美下載!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章