突破Flutter私有化仓库100M限制-Hosted packages must be smaller than 100 MB

本文介绍了在创建和发布Flutter私有仓库时遇到的100M大小限制问题。当尝试发布超过100M的包时,会收到错误提示。通过深入研究Flutter的验证器代码,发现在`size.dart`文件中定义了最大包大小为100MB。为解决此问题,可以尝试修改该限制以允许更大的包大小。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关于如何创建私有化Flutter仓库、发布Flutter私有化仓库请看这里。

Flutter私有化仓库创建、发布.

私有化仓库大小超过100M报错

如果个人创建的Flutter私有库大小超过100M,在使用pub publish发布私有化仓库过程中就会出现Your package is 602.9 MB. Hosted packages must be smaller than 100 MB

Package validation found the following error:
* Your package is 602.9 MB. Hosted packages must be smaller than 100 MB.
Package validation found the following potential issue:
* Your pubspec.yaml includes an "author" section which is no longer used and may be removed.
errors:[Your package is 602.9 MB. Hosted packages must be smaller than 100 MB.]
Sorry, your package is missing a requirement and can't be published yet.
For more information, see: https://dart.dev/tools/pub/cmd/pub-lish.

查找问题所在

根据报错在pub-SDK-2.10.0-64.0.dev中lib/src/validator/目录下找到size.dart文件,可以看到:

/// The maximum size of the package to upload (100 MB).
const _MAX_SIZE = 100 * 1024 * 1024;

查找到这里,就等于看到了症结所在。

只需要修改_MAX_SIZE的大小就可以突破私有仓库100M的大小限制。

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

songhai11

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值