skip to Main Content

I am trying to add images to my flutter app via assets. this is the where i have linked the images. this is the pubspec yaml file Tried different ways. nothing seems to work.

2

Answers


  1. First of all create a folder in your project named assets, not in your lib folder. After that in pubspace.yaml define your folder like this assets/images/

    enter image description here

    enter image description here

    Login or Signup to reply.
  2. You are doing wrong thing in pubspace.yaml.
    Maintain whitespaces as shown in below

    flutter:
      assets:
        - assets/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search