Home > Mobile >  I want to list the data I received from Firebase in the Dropdown Menu. Dropdown is unresponsive when
I want to list the data I received from Firebase in the Dropdown Menu. Dropdown is unresponsive when

Time:09-18

App view

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);
});

CodePudding user response:

I think that you're changing the data that has come as a response, try to:

List something = [];


var response;

await _firestore.collection("personeller").get().then((data) {
  response = data.docs[0].data();
  something = jsonDecode(response);
});

Let me know if it works, good luck!

CodePudding user response:

I solved my problem with a different usage. I used the question asked here before for the different method.

Source

  • Related