how to show user dropdown list from firebase and select flutter
StreamBuilder<QuerySnapshot>(
stream: Firestore.instance.collection('shops').snapshots(), builder: (context, snapshot) {
if (!snapshot.hasData)
return Center(
child: CupertinoActivityIndicator(),
);
return Container(
padding: EdgeInsets.only(bottom: 16.0),
child: Row(
children: <Widget>[
Expanded(
flex: 2,
child: Container(
padding: EdgeInsets.fromLTRB(12.0, 10.0, 10.0, 10.0),
child: Text(
"Shop",
),
)),
new Expanded(
flex: 4,
child: DropdownButton(
value: shopId,
isDense: true,
onChanged: (valueSelectedByUser) {
_onShopDropItemSelected(valueSelectedByUser);
},
hint: Text('Choose shop'),
items: snapshot.data.documents
.map((DocumentSnapshot document) {
return DropdownMenuItem<String>(
value: document.data['plant_name'] +
' ' +
document.data['shop_type'],
child: Text(document.data['plant_name'] +
' ' +
document.data['shop_type']),
);
}).toList(),
),
),
],
),
);
});