title: Drop-down menu using Map key/value pairs from api
body: <p>How can I get data from Map and put it in dropdown menu? I have an api working on websocket which returns me a Map of objects like <code>{&quot;1&quot;:&quot;cat&quot;, &quot;2&quot;:&quot;dog&quot;,&quot;3&quot;:&quot;bird&quot;}</code>, so I wanted to create a dropdown where users can choose the animal. As I know, the Map has key/value pair, so I need to use value in my case for drop-down menu. So my code now looks like that:</p>
  <pre><code>body: Futurebuilder&lt;Map&gt;(
  future: apiservice.getAnimal(), 
  builder:(context, snapshot){
  return: DropdownButton(
   value: snaphot.data.first,
   onChanged: (String newValue) {
       setState(() {
       snapshot.data.first = newValue; 
       });
   },
   items: snapshot.data.values.map((key, value) {
    return DropdownMenuItem(
     value: i, 
     child: Text(value));
   }).toList(),
  );})
  </code></pre>
  <p>But data doesn't display or it gives the error that string can't be the Map&lt;dynamic, dynamic&gt;. How can I solve it?</p>