如何在 Flutter 中引用存储库中的包?

How to reference packages from repository in Flutter?

我正在尝试修改 pub.dev 上的现有包。我需要更新包中的依赖项之一。我已经从 here

了解如何执行此操作
dependencies:
  flutter:
    sdk: flutter
  graphql_flutter:
    git:
      url: https://github.com/username/graphql-flutter.git

当我运行flutter pub get
我得到 pub get failed (1; Could not find a file named "pubspec.yaml"

正在查看 repository

中没有pubspec.yaml

我想我需要引用包文件夹中的 pubspec.yaml?那里有2个... 不确定该怎么做?

包裹是graphql_flutter

那是因为这是一个包含多个包的回购协议。您需要直接引用路径和分支,就像这样,例如 master 分支:

graphql_flutter:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql_flutter

如果你想要两个包:

graphql_flutter:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql_flutter

graphql:
    git:
      url: https://github.com/zino-app/graphql-flutter.git
      ref: master
      path: packages/graphql