I'm using the flutter_native_splash package. How do I fix this error?
Pubspec.yaml -
cupertino_icons:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash:
image: assets/splash.png
color: “6a1b9a”
android: true
fill: true
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
Error:
PS C:\Users\project> flutter pub pub run flutter_native_splash: create
Could not find package "flutter_native_splash". Did you forget to add a dependency?
This is a very silly issue. Even I encountered this today. Maybe we were referring same tutorial from where we took the commands. The problem is with the space just before create, proper command is flutter pub pub run flutter_native_splash:create
Got the solution from here
The correct command: flutter pub run flutter_native_splash:create
You just need to add flutter_native_splash in dev_dependencies too.
and later as define "flutter_native_splash:" after it.
Refer to the image: PUBSPEC.YAML
Check the indentation when you add the package, .yaml needs indentation to nest the package under the dependency
Add pub under dev_depences: in your pub.yaml file
dev_dependencies:
flutter_native_splash: ^1.2.1
Add file to project root folder where pub.yaml is: Run flutter_native_splash.yaml
Run flutter pub run flutter_native_splash:create --path=flutter_native_splash.yaml
Add the dependency in dev_dependencies not dependencies
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash: ^0.1.9 //Add this here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.