问题
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