FLutter:无法完成从 firestore 检索数据

FLutter : cant complete retrieving data from firestore

我尝试在构造函数中将查询从第一页传递到第二页

 Navigator.push(context, MaterialPageRoute(builder: (context) => ListWisataScreen(querySnapshot: dataService.getAllWisata(),)))

查询成功,数据显示出来,但只有一半,其他数据跟随错误

Bad state: field does not exist within the DocumentSnapshotPlatform

这里是错误screenshoot

这是第二页代码

FutureBuilder<QuerySnapshot>(
        future: querySnapshot,
        builder: (context, snapshot) {
          if(!snapshot.hasData || snapshot.connectionState == ConnectionState.waiting) {
            return Center(child: CircularProgressIndicator(strokeWidth: 3,),);
          } else if(snapshot.connectionState == ConnectionState.done && snapshot.hasData){
            return ListView.builder(
                shrinkWrap: true,
                physics: NeverScrollableScrollPhysics(),
                itemCount: snapshot.data.docs.length,
                itemBuilder: (context, index) {
                  var doc = snapshot.data.docs[index];
                  return ListTile(...);
                }
            );
          } else if(snapshot.connectionState == ConnectionState.none) {
            return Text("Tidak Ada Data");
          } else {
            return Text("Cek Koneksi Internet");
          }
        }
    )

您的错误出在您自己在 Firestore 中的数据中...

再看看你的第 5 个文件,你会发现它缺少一个字段或一个字段没有正确填写...很可能是错字..