-1

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.

  • You should use Image.asset widget and then as the first parameter you put the path to your image as a String. – Vayhuit Oct 04 '21 at 13:52
  • first change your line in pubspec -images to -assets/images then run pubget and then u can access the images – Awais Rehman Oct 04 '21 at 14:07

2 Answers2

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

MuhammedYesilmen
  • 129
  • 1
  • 12
0

You are doing wrong thing in pubspace.yaml. Maintain whitespaces as shown in below

flutter:
  assets:
    - assets/
G H Prakash
  • 1,720
  • 10
  • 30