如何在 pubspec.yaml 中指定dependency_overrides? [英] How to specify dependency_overrides in pubspec.yaml?
问题描述
我正在使用最新版本的 angular.dart 并且我的 pubspec.yaml
看起来有点像这样:
I am working with latest version of angular.dart and my pubspec.yaml
looks somewhat like this:
name: angularApp
dependencies:
angular:
git: 'git@github.com:angular/angular.dart'
third_party_angular_plugin: any
问题在于third_party_angular_plugin
取决于angular.dart
的稳定版本.我尝试指定如下:
the problem is third_party_angular_plugin
is depending on stable version of angular.dart
. I tried to specify as follows:
name: angularApp
dependencies:
angular:
git: 'git@github.com:angular/angular.dart'
third_party_angular_plugin: any
dependency_overrides:
angular:
version: ">=0.9.10"
但是它抛出了一个奇怪的错误,说 Bad State: No elements dart:core List.single ....
But it throws a weird error saying Bad State: No elements dart:core List.single ....
如何为我的应用覆盖 third_party_angular_plugin
对 angular 的依赖?
How can I override third_party_angular_plugin
's dependency on angular for my app?
推荐答案
version
不是单独的嵌套键,如 Pub Dependencies 页面,正确的格式是这样的:
The version
is not a separate nested key, as per the example on Pub Dependencies page, the right format is this:
name: angularApp
dependencies:
angular:
git: 'git@github.com:angular/angular.dart'
third_party_angular_plugin: any
dependency_overrides:
angular: ">=0.9.10"
这篇关于如何在 pubspec.yaml 中指定dependency_overrides?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!