invalid_dependency
Publishable packages can't have '{0}' dependencies.
Description
#The analyzer produces this diagnostic when a publishable package
includes a package in the dependencies
list of its pubspec.yaml
file
that isn't a pub-hosted dependency.
To learn more about the different types of dependency sources, check out Package dependencies.
Example
#The following code produces this diagnostic because the dependency on
the package transmogrify
isn't a pub-hosted dependency.
name: example
dependencies:
transmogrify:
path: ../transmogrify
Common fixes
#If you want to publish the package to pub.dev
, then change
the dependency to a hosted package that is published on pub.dev
.
If the package isn't intended to be published on pub.dev
, then
add a publish_to: none
entry to its pubspec.yaml
file to
mark it as not intended to be published:
name: example
publish_to: none
dependencies:
transmogrify:
path: ../transmogrify
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。