flutter pub 设置中国国内源

5 min read
  1. 打开终端,进入项目根目录

  2. 执行命令 flutter pub get,如果速度较慢,则可以执行以下国内源的设置命令

  3. 设置清华源:

flutter pub config --repositories https://mirrors.tuna.tsinghua.edu.cn/git/pypi/mirror/flutter/

  1. 设置阿里源:

flutter pub config --repositories https://mirrors.aliyun.com/dart-pub/flutter/

  1. 设置中科大源:

flutter pub config --repositories https://mirrors.ustc.edu.cn/dart-pub/flutter/

  1. 设置华为源:

flutter pub config --repositories https://repo.huaweicloud.com/repository/dart-pub/

  1. 执行命令 flutter pub get,就可以从国内源安装依赖包了。