unnecessary_dev_dependency
The dev dependency on {0} is unnecessary because there is also a normal dependency on that package.
Description
#The analyzer produces this diagnostic when there's an entry under dev_dependencies
for a package that is also listed under dependencies
. The packages under dependencies
are available to all of the code in the package, so there's no need to also list them under dev_dependencies
.
Example
#The following code produces this diagnostic because the package meta
is listed under both dependencies
and dev_dependencies
:
name: example
dependencies:
meta: ^1.0.2
dev_dependencies:
meta: ^1.0.2
Common fixes
#Remove the entry under dev_dependencies
(and the dev_dependencies
key if that's the only package listed there):
name: example
dependencies:
meta: ^1.0.2
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.