title: How to bind a Firestore documents list to a Dropdown menu in Flutter?
body: <p>I'm having a problem regarding dropdown menus and firestore, how can I bind a list of documents retrieved from firestore to a DropdownButton? Currently I'm having this error:</p>
  
  <pre><code>The argument type '(Map&lt;dynamic, dynamic&gt;) → DropdownMenuItem&lt;String&gt;' can't be assigned to the parameter type '(DocumentSnapshot) → dynamic'.
  </code></pre>
  
  <p>Code from my widget .dart:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:cloud_firestore/cloud_firestore.dart';
  
  class MessageList extends StatelessWidget {
    MessageList({this.firestore});
  
    final Firestore firestore;
    var _mySelection;
  
    @override
    Widget build(BuildContext context) {
      return StreamBuilder&lt;QuerySnapshot&gt;(
        stream: firestore.collection('preciso-modelos').snapshots(),
        builder: (BuildContext context, AsyncSnapshot&lt;QuerySnapshot&gt; snapshot) {
          if (!snapshot.hasData) return const Text('Loading...');
          return new DropdownButton&lt;String&gt;(
              isDense: true,
              hint: new Text("Select"),
              value: _mySelection,
              onChanged: (String newValue) {
                print (_mySelection);
              },
              items: snapshot.data.documents.map((Map map) {
                return new DropdownMenuItem&lt;String&gt;(
                  value: map["id"].toString(),
                  child: new Text(
                    map["name"],
                  ),
                );
              }).toList(),
          );},
          );
        }
  }
  </code></pre>
  
  <p>Thanks!</p>