Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 颤振:如何在Firestore中获取数据并在下拉按钮中显示这些数据?_Flutter_Dart_Google Cloud Firestore - Fatal编程技术网

Flutter 颤振:如何在Firestore中获取数据并在下拉按钮中显示这些数据?

Flutter 颤振:如何在Firestore中获取数据并在下拉按钮中显示这些数据?,flutter,dart,google-cloud-firestore,Flutter,Dart,Google Cloud Firestore,我从Firestore获取数据并将数据放入下拉按钮时遇到问题。我想在Firestore数据库中获取所有带有“组织名称”的条目,并将它们放在下拉按钮中 我的代码: child: DropdownButton<String>( elevation: 5, hint: Center( child: Text( "Choo

我从Firestore获取数据并将数据放入下拉按钮时遇到问题。我想在Firestore数据库中获取所有带有“组织名称”的条目,并将它们放在下拉按钮中

我的代码:

child: DropdownButton<String>(
                    elevation: 5,
                    hint: Center(
                      child: Text(
                        "Choose type of Organization",
                        style: TextStyle(
                          color: Colors.black,
                        ),
                      ),
                    ),
                    items: typesOfOrg.map((String dropDownString){
                      return DropdownMenuItem<String>(
                        value: dropDownString,
                        child: Text(dropDownString),
                      );
                    }).toList(),
                    onChanged: (value) {
                      setState(() {
                        _value = value;
                        print(value);
                      });
                    },
                    value: _value,
                  ),
在我的数据库中,我有以下结构:


到底是什么错误?没有错误,marc先生,我只想在firestore中获取数据并将其放入下拉按钮。但是您已经发布了代码,并且很可能尝试正确运行它?如果dropbox没有填充,一定是有错误吧?我代码中的数据只是静态的sir marc,所以现在我想尝试在我的数据库中获取数据并将其放入dropdownbutton。这就是我不知道该怎么做的事情:(
var typesOfOrg = ["Breast Cancer", "DSWD"];