I tried to list the data I received from Firebase in the dropdown menu in the dialog. I don’t get any errors in coding, but when clicking the menu it doesn’t open. Where am I doing wrong?
StatefulBuilder(builder:
(BuildContext context,
StateSetter setState) {
return DropdownButton<String>(
isDense: true,
hint: new Text("Proje Seçiniz"),
value: _selected1,
onChanged: (newValue) {
setState(() {
_selected1 = newValue;
});
print(_selected1);
},
items: data.map((list) {
return DropdownMenuItem<String>(
child: Row(
children: [
Image(
image: NetworkImage(list[
"personelResim"])),
Container(
margin: EdgeInsets.only(
left: 10),
child: Text(
list["name"] +
" " +
list["surname"],
style: TextStyle(
fontSize: 25),
)),
],
),
);
}).toList(),
);
}),
Firebase data retrieval codes
List data = [];
var response;
await _firestore.collection("personeller").get().then((data) {
response = data.docs[0].data();
data = jsonDecode(response);
});
2
Answers
I solved my problem with a different usage. I used the question asked here before for the different method.
Source
I think that you’re changing the
data
that has come as a response, try to:Let me know if it works, good luck!