问题
上传自己写的包到 pub 报错。
![3110861-b87e3a6c3fa03f0c.png](https://i-blog.csdnimg.cn/blog_migrate/cc3653a9290aa229ad540dcf88e9ebb5.webp?x-image-process=image/format,png)
异常.png
解决方法
1). 设置终端代理(一定要是终端代理)
export http_proxy=http://127.0.0.1:1080;
export https_proxy=http://127.0.0.1:1080;
2). 使用curl google.com
测试是否连通
curl google.com
![3110861-856cc52d6aa905df.png](https://i-blog.csdnimg.cn/blog_migrate/52f20925c30d477bb644d7a6e4c1d585.webp?x-image-process=image/format,png)
代表连通.png
3). 禁用设置的镜像源
unset FLUTTER_STORAGE_BASE_URL;
unset PUB_HOSTED_URL;
4). 检查是否可上传
flutter packages pub publish --dry-run --server=https://pub.dartlang.org
5). 上传
flutter packages pub publish --server=https://pub.dartlang.org
6). 上传成功
![3110861-7828c3de6dd04bb4.png](https://i-blog.csdnimg.cn/blog_migrate/7508e52e08fbd312c8ebf664d77c7e72.webp?x-image-process=image/format,png)
成功.png