项目简介
Pub 是 Dart 官方的包管理器。跨平台的前端应开发框架 Flutter 也基于 Dart 并且可以使用大部分 Pub 中的库。
使用方法
如果希望通过 pub 镜像安装软件,只需要设置 PUB_HOSTED_URL
以 bash 为例,临时使用镜像来安装依赖:
export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"
pub: pub get
flutter: flutter packages get
若希望长期使用镜像:
echo 'export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"' >> ~/.bashrc
Flutter 镜像使用方法参见 Flutter 镜像安装帮助。
评论