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

如何修复连接Firebase后出现的FallThroughError等编译错误?

修复Firebase相关编译失败问题

错误原因

  • FirebaseAppPlatform.verifyExtends 未找到:旧版firebase_core插件依赖的方法已被移除,属于Flutter SDK与Firebase插件版本不兼容导致。
  • FallThroughError 未找到:该类在Dart 2.17及以上版本已被移除,你使用的cloud_firestore_web、cloud_firestore_platform_interface版本过旧,依赖了已废弃API。

修复步骤

  • 升级Flutter SDK到稳定版
    执行命令:
    flutter upgrade
    
  • 更新Firebase相关插件版本
    打开项目根目录的pubspec.yaml,将所有Firebase依赖(如firebase_core、cloud_firestore)替换为最新稳定版,示例:
    dependencies:
      firebase_core: ^2.15.0
      cloud_firestore: ^4.8.3
    
    然后更新依赖:
    flutter pub get
    
  • 清除pub缓存
    若更新后仍报错,执行:
    flutter pub cache clean
    flutter pub get
    
  • 清理项目构建缓存
    最后执行:
    flutter clean
    flutter run
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.14 18:21:11