如何在pubspec.yaml中指定dependency_overrides? [英] How to specify dependency_overrides in pubspec.yaml?

查看:1446
本文介绍了如何在pubspec.yaml中指定dependency_overrides?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用最新版本的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"

但它引发一个奇怪的错误,说:坏状态:没有元素dart:core List。单个....

But it throws a weird error saying Bad State: No elements dart:core List.single ....

如何覆盖 third_party_angular_plugin

推荐答案

版本不是单独的嵌套键,根据 Pub依赖关系页面的示例,正​​确的格式是:

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆