M.ArslanKhan
M.ArslanKhan

Reputation: 3898

When I need to use dev_dependency

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 

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:

Upvotes: 3

Views: 985

Answers (1)

Ayush Bherwani
Ayush Bherwani

Reputation: 2729

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.

For Example:

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.

Upvotes: 3

Related Questions