Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Flutter type 'List<String>' is not a subtype of type 'String'

I am making my flutter firebase app and in it I’m fetching image from list but its giving me this error type 'List<String>' is not a subtype of type 'String' on this line in my listTile

 leading: Image.network(
                          _provider.dataToFirestore['images'][0]),

Now if I do convert it into string by adding .toString like this

 leading: Image.network(_provider.dataToFirestore['images']
                              [0]
                          .toString()),

my screen comes back and works but doesn’t shows the image cause it’s network type not string so how can I resolve this issue.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

This is where I’m storing my image

List<String> urlList = [];
Map<String, dynamic> dataToFirestore = {};

If anyone understand where I’m making issue please help, thanks

>Solution :

What this message mean is _provider.dataToFirestore['images'][0]) this returning a List of String not actually a String. You may know List<String> and String are not the same type of data.What I assume in your case _provider.dataToFirestore['images'][0][0]) will return a String from the List of String

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading