According to the documentation, the rule is simple:
The Rule for Deciding between a regular or dev dependency is simple:
If the dependency is Imported from Something in your lib or bin
Directories, it needs to be a regular dependency. If it’s only
Imported from test, example, etc. it can and should be a dev
dependency.
Explaining the sentence above, you will put in dev_dependency
only those Packages that you will use only in tests, examples and other things.
I mean, you’re just gonna put in dev_dependency
those Packages that you will use at development time, things that will not import to a final version...
Practical example
A practical example I can give is Mobx:
We put in dependencies
only the Packages
dependencies:
mobx:
flutter_mobx:
And in dev_dependencies
, we inform the Packages:
dev_dependencies:
mobx_codegen:
build_runner:
When we develop our application using Mobx, we need to use Mobx Widgets and classes to display and control actions from our application, so we import this package directly into dependencies
...
But while we’re developing, we need mobx_codegen
and build_runner
to generate the files *.g.dart
to assist in our development, so we just insert these dev_dependencies
.