0

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.

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

1
  • can you print _provider.dataToFirestore['images'][0] or _provider.dataToFirestore['images'][0].toString()? Commented Jan 29, 2022 at 8:15

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Yeah I understand what you're saying but with this line _provider.dataToFirestore['images'][0][]0) its giving syntax error what's the solution then
sorry typing mistake it suppose to be ['images'][0][0]) and I also edited my line
Swoop fixed thanks man

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.