找不到包“flutter_native_splash”。您是否忘记添加依赖项?

cmd*_*ter 2 yaml flutter

我正在使用flutter_native_splash包。我该如何修复这个错误?

\n\n

Pubspec.yaml -

\n\n
  cupertino_icons:\n\ndev_dependencies:\n  flutter_test:\n    sdk: flutter\n\nflutter_native_splash:\n image: assets/splash.png\n color: \xe2\x80\x9c6a1b9a\xe2\x80\x9d\n android: true\n fill: true\n\n# For information on the generic Dart part of this file, see the\n# following page: https://dart.dev/tools/pub/pubspec\n\n# The following section is specific to Flutter.\nflutter:\n
Run Code Online (Sandbox Code Playgroud)\n\n

错误:

\n\n
PS C:\\Users\\project> flutter pub pub run flutter_native_splash: create\nCould not find package "flutter_native_splash". Did you forget to add a dependency?\n
Run Code Online (Sandbox Code Playgroud)\n

Min*_*ink 5

这是一个非常愚蠢的问题。即使我今天也遇到了这种情况。也许我们引用的是与我们执行命令的地方相同的教程。问题出在创建之前的空间,正确的命令是flutter pub pub run flutter_native_splash:create

从这里得到了解决方案