You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

FirebaseFirestore中.get()与.then()间网络状态是否可能变化?

Firebase Firestore 网络状态场景疑问

代码示例

FirebaseFirestore.instance.collection('users').doc('123')
.get(GetOptions(source: Source.server)).then((value){
      if(/* 判断是否有网络 */){
        print('true');
      }else{
        print('false');
      }
    });

问题描述

  • 存在两个时间点:
    1. 调用.get()的时刻
    2. 进入.then()回调的时刻
  • 疑问:若调用.get()时网络可用且操作执行成功,进入.then()时网络不可用,是否存在这种可能性?
  • 注:已了解可使用.catchError()判断错误类型或用事务保证流程一致性,仅需回答是或否。

答案

是

内容的提问来源于stack exchange,提问作者Yousuf Essa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 22:17:00