扑来,无法获取Firebase查询快照

发布于 2025-02-10 09:59:00 字数 714 浏览 0 评论 0 原文

我从firebase获取数据并根据查询更新bool的数据。但是我的代码不起作用。 I tried printing the snapshots but I get "Instance of '_ControllerStream>>'" in the terminal how do I solve this.

Stream<QuerySnapshot<Map<String, dynamic>>>namees = await FirebaseFirestore
        .instance
        .collection('lender')
        .doc(auth.currentUser!.email)
        .collection('borrowers')
        .where('Name', isEqualTo: textfieldname).snapshots();
    print(namees);
    if (namees.isEmpty == true) {
      setState(() {
        isThere = true;
      });
    } else {
      setState(() {
        isThere = false;
      });
    }

I fetching data from firebase performing a query and updating a bool based on the query. But my code doesn't work. I tried printing the snapshots but I get "Instance of '_ControllerStream<QuerySnapshot<Map<String, dynamic>>>'" in the terminal how do I solve this.

Stream<QuerySnapshot<Map<String, dynamic>>>namees = await FirebaseFirestore
        .instance
        .collection('lender')
        .doc(auth.currentUser!.email)
        .collection('borrowers')
        .where('Name', isEqualTo: textfieldname).snapshots();
    print(namees);
    if (namees.isEmpty == true) {
      setState(() {
        isThere = true;
      });
    } else {
      setState(() {
        isThere = false;
      });
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文