I am not sure why my images from assets is not working
I looked at these two questions:
-https://stackoverflow.com/questions/64158543/flutter-unable-to-load-image-asset
-https://stackoverflow.com/questions/67552389/unable-to-load-image-asset
this is how I am trying to fetch the image:
Image(
image: AssetImage('assets/logo.png'),
width: 100,
height: 100,
),
here is my pubspec.yaml
assets:
- assets/logo.png
- assets/back.png
I tried following videos on youtube but that didnt work.
any suggestions are welcome
3
Answers
I ended up restarting the app then everyting worked
Try below code and change your
pubspec.yaml
file like-if your images in images folder
if your images in assetsfolder
after that run command
flutter pub get
and Stop the code and re-run againRefer assets-and-images
if your images are in images folder of assets folder then declare as below in pubspec.yaml
And write code to get image as below