Quantcast
Channel: Unable to load asset: Image - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Unable to load asset: Image

$
0
0

I have this code for asset image

 Image.asset('${listPic[1]}',            ),

the images are located in a List
final List<Image> listPic= <Image>[ Image.asset('assets/images/pic1.jpg'), Image.asset('assets/images/pic2.jpg'), ];

I know the pubsec works, because when I directly type the image location like this

Image.asset('assets/images/pic1.jpg',            ),

the image is displayed,Is there something wrong with the list or Image.asset()I have tried using .toString after the ${listPic[0]} it didn't do anything instead said unnecessary string interpolation.

gives this error

The following assertion was thrown resolving an image codec: Unable to load asset: Image(image: AssetImage(bundle: null, name: "assets/images/pic1.jpg"), frameBuilder: null, loadingBuilder: null, alignment: Alignment.center, this.excludeFromSemantics: false, filterQuality: low)

Viewing all articles
Browse latest Browse all 2

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>