简体   繁体   中英

Flutter: Unable to load asset file

I have added my assets into my projects directory also did everything on pubspec.yaml but I am still getting the Unable to load asset.

I also tried giving a specific path (like - assets/image/x.png ) in pubspec, but nothing changed.

What am I doing wrong?

I used it like this

我是这样用的

pubspec.yaml

发布规范

assets folder

资产文件夹

@vinternal 只需停止并再次运行应用程序。

Turns out i forgot to put a - before family: Roboto. Just fixed it

You should carefully follow the structure:

  1. Hey put the assets folder in root folder, I think you have put it under lib folder.

  2. Intendation(space) before the -asset/images in pubspec.yaml should not be changed otherwise it may have issue

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM