[英]flutter_native_splash package: image does not scale down on Android
[英]Could not find package "flutter_native_splash". Did you forget to add a dependency?
我正在使用flutter_native_splash package。如何修復此錯誤?
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:
錯誤:
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?
這是一個非常愚蠢的問題。 即使我今天遇到了這個。 也許我們指的是從我們獲取命令的地方相同的教程。 問題在於創建之前的空間,正確的命令是flutter pub pub run flutter_native_splash:create
從這里得到解決方案
正確命令: flutter pub run flutter_native_splash:create
你只需要在 dev_dependencies 中添加flutter_native_splash 。
然后在它之后定義“flutter_native_splash:”。
參考圖片: PUBSPEC.YAML
添加 package 時檢查縮進,.yaml 需要縮進以嵌套 package 下的依賴項
在 dev_depences 下添加 pub:在您的 pub.yaml 文件中
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
在 dev_dependencies 中添加依賴而不是依賴
dev_dependencies:
flutter_test:
sdk: flutter
flutter_native_splash: ^0.1.9 //Add this here
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.