I want to show some local image and display it on the screen like this:
Image(image: AssetImage('assets/images/addFood.png'))
But I cannot see the image on the screen and I am getting no error at all.
Here is what I have done:
In my pubspec.yaml
I have added my image folder like this:
assets:
- lib/assets/images/
The image named "addFood" is inside images
folder as you can see here:
I want to display a simple text with image under it, I can see the text on the screen and I am doing it like this:
Widget build(BuildContext context) {
if (favoriteMeals.isEmpty)
return Column(children: <Widget>[
Text('no favorites',style: Theme.of(context).textTheme.title,),
Image(image: AssetImage('assets/images/addFood.png'))
]);
else{
......
......
......
}
All I can see is the text without the image:
solutions that did not help in my case:
AssetImage is not not displaying image in flutter app
mage Not Appearing when Using "new Image.asset" inside a Column
How can I fix it and make sure that the image will be displayed on the screen?