[英]Flutter pubspec.yaml - Adding forked dependency from branch - A dependency may only have one source
I had to modify an existing pub package which has multiple branches besides the main one.我不得不修改一个现有的酒吧 package除了主要的分支之外还有多个分支。 I needed the branch
3x_null_safety
So I forked the repo, modified the code and pushed it to my github.我需要分支
3x_null_safety
所以我分叉了 repo,修改了代码并将其推送到我的 github。
dependencies:
geoflutterfire:
git:
url: https://github.com/[myUsername]/GeoFlutterFire
ref: 3x_null_safety
Also tried this:也试过这个:
dependencies:
geoflutterfire:
git: git://github.com/[myUsername]/GeoFlutterFire.git
ref: 3x_null_safety
In both cases I'm getting this error:在这两种情况下,我都会收到此错误:
pubspec.yaml: A dependency may only have one source
pubspec.yaml:依赖可能只有一个来源
Indentation is important.缩进很重要。
As shown in the pubspec.yaml
examples for Git repositories , you should use:如Git 存储库的
pubspec.yaml
示例中所示,您应该使用:
dependencies:
geoflutterfire:
git:
url: https://github.com/[myUsername]/GeoFlutterFire
ref: 3x_null_safety
That is, ref
should be a field of git
, not of geoflutterfire
.也就是说,
ref
应该是git
的字段,而不是geoflutterfire
的字段。 By using the wrong indentation, ref:
was treated as a source in addition to the git
one.通过使用错误的缩进,
ref:
除了git
之外,还被视为源。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.