What's the difference between pub dependencies and dev_dependencies?

前端 未结 2 955
长发绾君心
长发绾君心 2021-01-08 00:09

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

相关标签:
2条回答
  • 2021-01-08 00:20

    There are two types of dependencies, one is regular and the other is dev.

    dependencies:

    Regular dependencies are listed under dependencies:—these are packages that anyone using your package will also need.

    dev_dependencies:

    Dependencies that are only needed in the development phase of the package itself are listed under dev_dependencies.


    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 here).

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

    0 讨论(0)
  • 2021-01-08 00:36

    dev_dependencies are dependencies that are not available for code in the resulting application, but only for tests, examples, tools, or to add executable tools like for code generation to your project.

    dev_dependencies of any dependencies in your project (dependencies or dev_dependencies) are always ignored when you publish to pub.dev.

    See also https://www.dartlang.org/tools/pub/pubspec.html

    0 讨论(0)
提交回复
热议问题