how to import both text and images to pubspec yaml

Issue

I want to import both font and images to pubspec.yaml but it gives me an error why?
here is my code

flutter:
  assets:
    - assets/posts/
    - assets/stories/
    assets/avatars/
  fonts:
    - family: Klavika
      fonts:
        - asset: fonts\KlavikaBold.otf

Solution

pubspec.yaml is sensitive to indentation. You have missed - for your avatar folder. Hope the code below should work.

flutter:
  assets:
    - assets/posts/
    - assets/stories/
    - assets/avatars/
  fonts:
    - family: Klavika
      fonts:
        - asset: fonts\KlavikaBold.otf

Answered By – Sudeep Bashistha

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *