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

Flutter Web因Firebase Analytics和Remote Config构建失败求助

解决Flutter Web构建时PromiseJsImpl找不到的错误

错误原因

firebase_analytics_web旧版本(0.5.5+21)与当前Flutter环境的js包版本不兼容,导致无法找到PromiseJsImpl类型。

解决方案

方案1:更新所有Firebase依赖到兼容稳定版

修改pubspec.yaml中的Firebase依赖为适配Flutter 3.19.6的最新兼容版本:

# Firebase
firebase_core: ^2.24.2
firebase_auth: ^4.16.0
firebase_storage: ^11.6.0
firebase_messaging: ^14.7.10
firebase_analytics: ^10.15.0
firebase_crashlytics: ^3.6.10
cloud_firestore: ^4.14.0
firebase_remote_config: ^4.6.0

执行以下命令:

flutter pub upgrade
flutter clean
flutter pub get
flutter build web

方案2:单独指定兼容的firebase_analytics_web版本

如果不想全量更新Firebase依赖,可直接在pubspec.yaml中添加与firebase_analytics 10.8.1兼容的版本:

firebase_analytics_web: ^0.5.13+1

然后执行:

flutter clean
flutter pub get
flutter build web

方案3:确保js包版本正确

若上述方案无效,手动指定js包的最新稳定版:

js: ^0.6.7

再执行flutter pub get后重新构建Web项目。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 09:34:53