相关疑难解决方法(0)

与多个本地 flutter 和 dart 包共享 pubspec.yaml 包依赖项版本

我的 flutter 项目依赖于几个本地 flutter 和 dart 包来保持分离和干净。\n我的文件夹结构如下:

\n
main-flutter-project\n\xe2\x94\x82  lib\n|  test\n\xe2\x94\x82  pubspec.yaml\n\xe2\x94\x82\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 local-packages\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 dart-package-1\n\xe2\x94\x82   \xe2\x94\x82     pubspec.yaml\n\xe2\x94\x82   \xe2\x94\x82\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 flutter-package-1\n\xe2\x94\x82   \xe2\x94\x82     pubspec.yaml\n\xe2\x94\x82   \xe2\x94\x82\n\xe2\x94\x82   \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 flutter-package-2\n\xe2\x94\x82         pubspec.yaml\n...\n
Run Code Online (Sandbox Code Playgroud)\n

每个本地包都是独立的,可以在不接触主项目的情况下进行维护。

\n

这种结构意味着我有很多pubspec.yaml文件,我必须在其中保持依赖项的更新。\n当我在 5 个包中使用 libaray 时bloc,当新版本发布时,bloc: ^7.2.1我必须分别更新每个文件中的版本。pubspec

\n

是否可以仅在其他pubspec.yaml文件引用的一个位置指定这些共享包依赖项版本?

\n

我已经在 Maven 中看到了这一点,您可以在其中指定一个属性<junit.version>4.12</junit.version>并从其他地方访问它<version>${junit.version}</version>

\n

dependency-management dart flutter pubspec

9
推荐指数
1
解决办法
2205
查看次数

标签 统计

dart ×1

dependency-management ×1

flutter ×1

pubspec ×1