![](/img/trans.png)
[英]In flutter, How to add tflite as a dependency in pubspec.yaml ?file?
[英]how to add a picture path on pubspec.yaml file on flutter
我通過添加要添加的圖片的文件夾路徑修改了我的pubspec.yaml
文件,但出現錯誤:
Running "flutter pub get" in drawer2...
Error on line 44, column 5 of pubspec.yaml: Expected a key while parsing a block mapping.
╷
44 │ assets :
│ ^
╵
Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Crash report sent (report ID: 7f0c2ad768060692)
Crash report written to C:\Users\Mohamed bh\Desktop\files\flutter operations\drawer2\flutter_06.log;
please let us know at https://github.com/flutter/flutter/issues.
//我的pubspec.yaml代碼
撲:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets :
- assets/
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
Running "flutter pub get" in drawer2...
Error on line 44, column 5 of pubspec.yaml: Expected a key while parsing a block mapping.
╷
44 │ assets :
│ ^
╵
Oops; flutter has exited unexpectedly.
Sending crash report to Google.
Crash report sent (report ID: 7f0c2ad768060692)
Crash report written to C:\Users\Mohamed bh\Desktop\files\flutter operations\drawer2\flutter_06.log;
please let us know at https://github.com/flutter/flutter/issues.
您應該尊重縮進,即使添加或刪除一個空格也不會起作用,這是您應該這樣做的方式:
flutter:
assets:
- assets/my_icon.png
- assets/background.png
最好的方法是從官方文檔中復制/過去。
如果上述解決方案不起作用
嘗試重新啟動您的 IDE(Andriod studio/VSCode),它對我有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.