简体   繁体   English

Flutter pubspec.yaml - 从分支添加分叉依赖 - 依赖可能只有一个来源

[英]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.

相关问题 Flutter Pubspec.yaml 警告:可发布包不能有 git 依赖项 - Flutter Pubspec.yaml Warning: Publishable packages can't have git dependencies Flutter/Git — 帮助替换 pubspec.yaml 中的 package - Flutter/Git — Help replacing package in pubspec.yaml Flutter 的 pubspec.yaml 版本更改的自动提交标记 - Automatic commit tagging on pubspec.yaml version change for Flutter 如何修复 pubspec.yaml 和 pubspec.lock 中的合并冲突? - How do I fix merge conflic in pubspec.yaml and pubspec.lock? 可视化git分支依赖 - Visualize git branch dependency 通过composer在github上使用fork repo作为依赖 - Use forked repo on github via composer as dependency 使用分叉的 swift 包作为 Vapor 项目的依赖项 - Using a forked swift package as a dependency for Vapor project 如何将 cloud_firestore 插件的主仓库版本(在 flutterfire 包中)添加到我的应用程序的 pubspec.yaml? - How do i add the master repo version of cloud_firestore plugin (inside flutterfire package) to my app's pubspec.yaml? Git filter-branch 只针对分叉提交 - Git filter-branch only on forked commits 如何将分叉的分支与其原始分支进行比较? - How to compare a forked branch with its original one?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM