Module 如何组织多包颤振项目并将其用作依赖项

Module 如何组织多包颤振项目并将其用作依赖项,module,dart,flutter,dart-pub,flutter-dependencies,Module,Dart,Flutter,Dart Pub,Flutter Dependencies,我想将一个颤振项目组织成一个具有以下要求的多包项目: 为此项目使用一个存储库 开发人员能够在本地处理此存储库中的包 使包作为依赖项可从此存储库之外的其他项目访问 我现在拥有的存储库的文件设置为: . ├── app_base │ ├── ... │ └── pubspec.yaml ├── feature │ ├── ... │ └── pubspec.yaml └── README.md 我在app\u base/pubspec.yaml中尝试过这样使用路径依赖项: na

我想将一个颤振项目组织成一个具有以下要求的多包项目:

  • 为此项目使用一个存储库
  • 开发人员能够在本地处理此存储库中的包
  • 使包作为依赖项可从此存储库之外的其他项目访问
我现在拥有的存储库的文件设置为:

.
├── app_base
│   ├── ...
│   └── pubspec.yaml
├── feature
│   ├── ...
│   └── pubspec.yaml
└── README.md
我在
app\u base/pubspec.yaml
中尝试过这样使用路径依赖项:

name: app_base

dependencies:
  feature:
    path: ../feature
它适用于本地开发,但如果我尝试在完全不同的项目中使用
app_base
,而不是使用路径,而是使用git依赖项:

name: actual_app

dependencies:
  app_base:
    git:
      url: ssh://address.to/the_repo.git
      path: app_base
      ref: deadbaca

Running "flutter packages get" in actual_app...            
Error on line 21, column 11: Invalid description: "../feature" is a relative path, but this isn't a local pubspec.
    path: ../feature
          ^^^^^^^^^^

pub get failed (65)
Process finished with exit code 65
它无法解析可传递的
功能
依赖项:

name: actual_app

dependencies:
  app_base:
    git:
      url: ssh://address.to/the_repo.git
      path: app_base
      ref: deadbaca

Running "flutter packages get" in actual_app...            
Error on line 21, column 11: Invalid description: "../feature" is a relative path, but this isn't a local pubspec.
    path: ../feature
          ^^^^^^^^^^

pub get failed (65)
Process finished with exit code 65

有没有一种方法可以使它既适用于本地开发,又用作其他项目的git依赖项?

只需对这两种场景(本地和其他项目)使用git依赖项即可

如果您认为这在本地开发期间很麻烦,请在本地使用路径依赖项,并在提交之前将其更改回Git