Error: unable to locate asset entry in pubspec.yaml:

3,042 views
Skip to first unread message

Kum Hon Loke

unread,
Aug 31, 2020, 6:03:18 AM8/31/20
to Flutter Development (flutter-dev)
Hi, could u help me solve an issue. I added the Open Sans fonts folder to my app. In my visual studio code, it says Error: unable to locate asset entry in pubspec.yaml: "assets/fonts/OpenSans-ExtraBold.ttf". Could u help me to solve it? Thanks  
Screenshot (92).png

Souvik Dutta

unread,
Aug 31, 2020, 6:39:40 AM8/31/20
to Kum Hon Loke, Flutter Development (flutter-dev)
Check for indentation mistakes. I think "-family" is not properly indented.

On Mon, Aug 31, 2020, 3:33 PM Kum Hon Loke <kumh...@gmail.com> wrote:
Hi, could u help me solve an issue. I added the Open Sans fonts folder to my app. In my visual studio code, it says Error: unable to locate asset entry in pubspec.yaml: "assets/fonts/OpenSans-ExtraBold.ttf". Could u help me to solve it? Thanks  

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/8163b37c-d642-4889-b9f4-b05bd70c9c6fn%40googlegroups.com.

Ariyo Ademidun

unread,
Aug 31, 2020, 7:23:33 AM8/31/20
to Flutter Development (flutter-dev)
Screenshot (22).png
Check your indentation, it should be something like this.
Message has been deleted

Kum Hon Loke

unread,
Aug 31, 2020, 9:49:30 AM8/31/20
to Flutter Development (flutter-dev)
Hi, what do you mean by indentation mistakes?

Souvik Dutta

unread,
Aug 31, 2020, 10:27:42 AM8/31/20
to Kum Hon Loke, Flutter Development (flutter-dev)
The amount of spaces before the line " -family...."  is not correct. Give some spaces before the line as stated above(possibly a tab). 

Kum Hon Loke

unread,
Aug 31, 2020, 11:48:05 AM8/31/20
to Flutter Development (flutter-dev)
i still have the same issue after giving inserting the amount of spaces before the line "-family..." Still can't fix it.

Souvik Dutta

unread,
Aug 31, 2020, 11:40:20 PM8/31/20
to Kum Hon Loke, Flutter Development (flutter-dev)
The lines below "-family" are needed to be treated the same way. Select app of them and press tab. 

Hugo van Galen

unread,
Sep 1, 2020, 3:06:58 AM9/1/20
to Souvik Dutta, Kum Hon Loke, Flutter Development (flutter-dev)
Come on guys -- the pubspec is fine. The screenshot clearly shows the path should be "assets/fonts/OpenSans/OpenSans-ExtraBold.ttf". Note that it's in a sub directory.


Kum Hon Loke

unread,
Sep 1, 2020, 3:42:51 AM9/1/20
to Flutter Development (flutter-dev)
So how do i make the path correctly? As i already had the path folder of  "assets/fonts/OpenSans/OpenSans-ExtraBold.ttf".  

Nikola Jovanoski

unread,
Sep 1, 2020, 3:48:24 AM9/1/20
to Flutter Development (flutter-dev)

Annotation 2020-09-01 094705.png
try the indentation like on this example
Reply all
Reply to author
Forward
0 new messages