问题描述
如果我需要任何依赖关系,可以在dependencies
下使用它们
If I need any dependency I use them under dependencies
like this
dependencies:
flutter:
sdk: flutter
provider: ^3.2.0
http: ^0.12.0+3
get_it: ^3.1.0
connectivity: ^0.4.6
email_validator: ^1.0.4
shared_preferences: ^0.5.4+8
google_maps_flutter: ^0.5.21+14
何时可以使用uder dev_dependencies软件包?我不知道要在软件包中看到什么,以便可以确定哪个依赖项属于哪个类别.
When I can use packages uder dev_dependencies? I don't know what I have to see in the packages so that I can decide which dependency goes to which category.
dev_dependencies:
推荐答案
Pub支持两种依赖关系:常规依赖关系和dev_dependencies.开发依赖项与常规依赖项的不同之处在于,您依赖的软件包的dev_dependencies将被忽略.
Pub supports two flavors of dependencies: regular dependencies and dev_dependencies. Dev dependencies differ from regular dependencies in that dev_dependencies of packages you depend on are ignored.
例如:
如果您正在开发一个软件包,并且想要一些仅出于测试目的而不是实际实现的目的导入的软件包,则此类软件包应位于dev_dependencies下.导入软件包时,pub会获取导入的软件包所依赖的每个软件包.由于pub会忽略dev_dependencies,因此pub不会获取用于测试的软件包.
If you are developing a package, and you want some packages which are only imported for testing purpose and not the actual implementation, then such packages should go under dev_dependencies. When you are importing a package, pub gets every package that your imported package depends on. Since pub ignores dev_dependencies, the packages which were used for testing won't be fetched by pub.
这篇关于当我需要使用dev_dependency的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!