title: in flutter List<dynamic> is not a subtype of List<String>
body: <p>I called the <code>AttachmentWidget(snapshot.data)</code> the method inside the column widget, So dynamically get the data from the API. After receiving this data, According to the <code>ext</code> i stored into the path List, for example, that is an image extension, I will store as an image path In this case if I get 5 images, I want to path 5 path lists into the Photogrid <code>imageUrls: imgpathList,</code> For this, I got an error as </p>
  
  <blockquote>
    <p>error message</p>
  </blockquote>
  
  <pre><code>List&lt;dynamic&gt;  is not a subtype of List&lt;String&gt;
  </code></pre>
  
  <p>So, How to convert List as a List or is there any way to do that? Thank you</p>
  
  <blockquote>
    <p>Code here</p>
  </blockquote>
  
  <pre><code>Widget AttachmentWidget(List&lt;Attachment&gt; attachmentmodel)
    {
      int listsize=attachmentmodel.length;
  
      var imgpathList = new List();
      var videopathList = new List();
      var audiopathList = new List();
  
  
      int images=0;
      int videos=0;
      int audio=0;
      int others=0;
  
      Set &lt;String&gt; ImageExt = {'jpg','png','jpeg','tiff'};
      Set &lt;String&gt; VideoExt = {'mp4','mpeg4','wmp'};
      Set &lt;String&gt; AudioExt={'mpga'};
  
      for(int i=0;i&lt;=listsize-1;i++)
        {
          String ext=attachmentmodel[i].ext;
          String path=attachmentmodel[i].path;
  
          if(ImageExt.contains(ext))
            {
              images=images+1;
              imgpathList.add(path);
            }
          else if(VideoExt.contains(ext))
            {
              videos=videos+1;
              videopathList.add(path);
            }
          else if(AudioExt.contains(ext))
            {
              audio=audio+1;
              audiopathList.add(path);
            }
          else
            {
              others=others+1;
            }
        }
  
  
      if(listsize==0)
        {
          return Container();
        }
      else if(listsize==1&amp;&amp;images==1)
        {
          return Container(
            height: 200,
            width: MediaQuery.of(context).size.width,
            child: Image.network(
              imgpathList[0]
            )
          );
        }
      else if(listsize==1&amp;&amp;videos==1)
        {
          return Text('video');
        }
      else if(listsize==1&amp;&amp;audio==1)
        {
          return Text('audio');
        }
      //////////////////////////////list size 2
      else if(listsize==2&amp;&amp;images==2)
        {
          return Container(
              height: 200,
              width: MediaQuery.of(context).size.width,
              child: Row(
                children: &lt;Widget&gt;[
                  Image.network(
                      imgpathList[0]
                  ),
                  Image.network(
                      imgpathList[1]
                  ),
                ],
              )
          );
        }
      else if(listsize==2&amp;&amp;videos==2)
      {
        return Text('2 videos');
      }
      else if(listsize==2&amp;&amp;audio==2)
      {
        return Text('2 audios');
      }
      else if(listsize==2&amp;&amp;images==1&amp;&amp;videos==1)
      {
        return Container(
          height: 200,
          width: MediaQuery.of(context).size.width,
          child: Row(
            children: &lt;Widget&gt;[
  
                Image.network(
                imgpathList[0]
                    ),
  
              Text('video2')
  
            ]
          )
        );
      }
      else if(listsize==2&amp;&amp;images==1&amp;&amp;audio==1)
        {
          return Container(
              height: 200,
              width: MediaQuery.of(context).size.width,
              child: Row(
                  children: &lt;Widget&gt;[
  
                    Image.network(
                        imgpathList[0]
                    ),
  
                    Text('audio')
  
                  ]
              )
          );
        }
        else if(listsize==2&amp;&amp;videos==1&amp;&amp;audio==1)
        {
          return Container(
              height: 200,
              width: MediaQuery.of(context).size.width,
              child: Row(
                  children: &lt;Widget&gt;[
  
                   Text('video'),
  
                    Text('audio')
  
                  ]
              )
          );
        }
        else if(listsize==3&amp;&amp;images==3)
          {
            return Container(
                height: 200,
                width: MediaQuery.of(context).size.width,
                child: Row(
                    children: &lt;Widget&gt;[
                      Container(
                        height: 200,
                        child: Image.network(
                            imgpathList[0]
                        ),
                      ),
                      Container(
                        height: 200,
                        child: Column(
                          children: &lt;Widget&gt;[
                            Container(
                              height: 100,
                              child: Image.network(
                                  imgpathList[1]
                              ),
                            ),
                            Container(
                              height: 100,
                              child: Image.network(
                                  imgpathList[2]
                              ),
                            ),
                          ],
                        ),
                      ),
                    ]
                )
            );
          }
      else if(listsize==3&amp;&amp;videos==3)
      {
        return Container(
            height: 200,
            width: MediaQuery.of(context).size.width,
            child: Row(
                children: &lt;Widget&gt;[
                  Container(
                      height: 200,
                      child: Text('1')
                  ),
                  Container(
                    height: 200,
                    child: Column(
                      children: &lt;Widget&gt;[
                        Container(
                            height: 100,
                            child: Text('2')
                        ),
                        Container(
                            height: 100,
                            child: Text('3')
                        ),
                      ],
                    ),
                  ),
                ]
            )
        );
      }
      else if(listsize==4&amp;&amp;images==4)
        {
          return Container(
              height: 300,
              width: MediaQuery.of(context).size.width,
              child: Row(
                  children: &lt;Widget&gt;[
                    Container(
                        height: 300,
                        child: Column(
                          children: &lt;Widget&gt;[
                            Container(
                              height:150,
                              width: 150,
                              child: Image.network(
                                  imgpathList[0]
                              ),
                            ),
                            Container(
                              height:150,
                              width: 150,
                              child: Image.network(
                                  imgpathList[1]
                              ),
                            ),
                          ],
                        )
                    ),
                    Container(
                        height: 300,
                        child: Column(
                          children: &lt;Widget&gt;[
                            Container(
                              height:150,
                              width: 150,
                              child: Image.network(
                                  imgpathList[2]
                              ),
                            ),
                            Container(
                              height:150,
                              width: 150,
                              child: Image.network(
                                  imgpathList[3]
                              ),
                            ),
                          ],
                        )
                    ),
                  ]
              )
          );
        }
  
      else if(listsize&gt;=5&amp;&amp;images&gt;=5)
        {
          return PhotoGrid(
            imageUrls: imgpathList,
            onImageClicked: (i) =&gt; print('Image $i was clicked!'),
            onExpandClicked: () =&gt; print('Expand Image was clicked'),
            maxImages: 4,
          );
  
        }
      else
        {
         return Text('list size    $listsize \n images     $images \n  videos    $videos  \n audios  $audio');
        }
  
      }
  </code></pre>