Summary
Some packages are intended to be used only as development dependencies, such as code generators, linters, and testing tools.
However, the Install tab on pub.dev always generates a regular install command, for example:
dart pub add build_runner
This can mislead users into adding development-only packages to dependencies instead of dev_dependencies.
Examples
Examples of packages that are typically added as development dependencies:
build_runner
flutter_lints
test
riverpod_generator
For these packages, the recommended command would instead be:
dart pub add dev:build_runner
(or the equivalent command for the current supported syntax).
Proposal
Allow package authors to indicate that a package is intended to be installed as a development dependency.
pub.dev could then generate the appropriate install command automatically for those packages.
This would only affect the generated installation instructions and would not prevent users from installing the package as a regular dependency if they intentionally choose to do so.
Motivation
Many beginners simply copy and paste the generated command from the Install tab.
Providing the recommended command would help users follow best practices and reduce accidental misuse of development-only packages.
Summary
Some packages are intended to be used only as development dependencies, such as code generators, linters, and testing tools.
However, the Install tab on pub.dev always generates a regular install command, for example:
This can mislead users into adding development-only packages to
dependenciesinstead ofdev_dependencies.Examples
Examples of packages that are typically added as development dependencies:
build_runnerflutter_lintstestriverpod_generatorFor these packages, the recommended command would instead be:
(or the equivalent command for the current supported syntax).
Proposal
Allow package authors to indicate that a package is intended to be installed as a development dependency.
pub.dev could then generate the appropriate install command automatically for those packages.
This would only affect the generated installation instructions and would not prevent users from installing the package as a regular dependency if they intentionally choose to do so.
Motivation
Many beginners simply copy and paste the generated command from the Install tab.
Providing the recommended command would help users follow best practices and reduce accidental misuse of development-only packages.