How to specify dependency_overrides in pubspec.yaml?

∥☆過路亽.° 提交于 2019-12-08 06:45:40

问题


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

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"

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

How can I override third_party_angular_plugin's dependency on angular for my app?


回答1:


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"


来源:https://stackoverflow.com/questions/23031384/how-to-specify-dependency-overrides-in-pubspec-yaml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!