What's the difference between pub dependencies and dev_dependencies?

大城市里の小女人 提交于 2019-12-30 09:30:15

问题


What is the difference in dependencies and dev_dependencies in a pubspec.yaml? It seems that when I run pub get the dev_dependencies aren't downloaded.


回答1:


dev_dependencies are only used when you run pub get/pub upgrade for the package directly where they are in the pubspec.yaml. dev_dependencies of dependent packages (dependencies or dev_dependencies) are always ignored. Hence dev_dependencies are only relevant to tasks relevant to development (test, tool, example,... ) of your package but not when it's used as a dependency.
See also https://www.dartlang.org/tools/pub/pubspec.html




回答2:


If your package (say A) depends on another package (say B) (which further has dev-dependencies), then your package (A) simply ignores the dev-dependencies used by that package (B).

However, your package (A) will depend on the packages (which are specified under dependency) of B package.



来源:https://stackoverflow.com/questions/32108457/whats-the-difference-between-pub-dependencies-and-dev-dependencies

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