Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.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 查询不起作用的Flatter firestore_Flutter_Google Cloud Firestore - Fatal编程技术网

Flutter 查询不起作用的Flatter firestore

Flutter 查询不起作用的Flatter firestore,flutter,google-cloud-firestore,Flutter,Google Cloud Firestore,在我的Flatter应用程序中,我需要使用where查询将我的用户输入数据与firestore数据进行比较。但它没有显示任何东西 这是我的密码 Stream<QuerySnapshot> comparision(BuildContext context) async* { yield* Firestore.instance.collection('Schedules') .where('from', isEqualTo: widget.

在我的Flatter应用程序中,我需要使用where查询将我的用户输入数据与firestore数据进行比较。但它没有显示任何东西

这是我的密码

    Stream<QuerySnapshot> comparision(BuildContext context) async* {
        yield* Firestore.instance.collection('Schedules')
            .where('from', isEqualTo: widget.from)
            .where('to', isEqualTo: widget.to)
            .snapshots();
      }
当我删除where查询时,它会显示所有内容

Firestore结构如下(注意:此处仅显示“发件人”字段,但也有一个名为“收件人”的字段)


如何修复此问题?

要为您了解此问题,您能否提供Firestore数据结构的屏幕截图?我包括了结构。。。这是图像链接我在这里找到了一个文档,可以帮助您缩小问题范围。()仍然没有解释没有显示全局变量,我需要澄清。你能告诉我关于全局变量的事吗?你能给我看更多全局变量的代码吗?
    StreamBuilder(
          stream: comparision(context),
          builder: (context, snapshot) {
            if (!snapshot.hasData){
              return Center(child: CircularProgressIndicator());
            }
            return ListView.builder(
                itemCount: snapshot.data.documents.length,
                itemBuilder: (context, index){
                  DocumentSnapshot power = snapshot.data.documents[index];
                  return Container(
                    height: 200,
                    width: MediaQuery.of(context).size.width,
                    child: Column(
                      children: [
                        Text(power['from']),
                        Text(power['to'])
                      ],
                    ),
                  );
                }
            );
          },
        )