我的 flutter 项目依赖于几个本地 flutter 和 dart 包来保持分离和干净。\n我的文件夹结构如下:
\nmain-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...\nRun Code Online (Sandbox Code Playgroud)\n每个本地包都是独立的,可以在不接触主项目的情况下进行维护。
\n这种结构意味着我有很多pubspec.yaml文件,我必须在其中保持依赖项的更新。\n当我在 5 个包中使用 libaray 时bloc,当新版本发布时,bloc: ^7.2.1我必须分别更新每个文件中的版本。pubspec
是否可以仅在其他pubspec.yaml文件引用的一个位置指定这些共享包依赖项版本?
我已经在 Maven 中看到了这一点,您可以在其中指定一个属性<junit.version>4.12</junit.version>并从其他地方访问它<version>${junit.version}</version>。