简体   繁体   English

Flutter Web 与 Firebase,错误“dart_sdk.js 没有模块”

[英]Flutter Web with Firebase, error "No module for dart_sdk.js"

When running Firebase on android, there is no problem, but when debugging on the web (chrome or edge), it doesn't work... in the Debug Console a DART_SDK.JS problem notification appears, like this:在 android 上运行 Firebase 时没有问题,但是在 web(chrome 或 edge)上调试时,它不起作用...在调试控制台中出现这样的通知:DART_SDK.JS 问题:

"Locations: No module for http://localhost:53xxx/dart_sdk.js" “位置:http://localhost:53xxx/dart_sdk.js 没有模块”

This notification only appears when running at Firebase.initializeApp();此通知仅在Firebase.initializeApp() 运行时出现;

My Code:我的代码:

 void main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); runApp( MaterialApp( title: "Firebase", home: MyApp() ) ); }

The problem is that you need to configure some extra things for web to work in your initializeApp method问题是您需要为 web 配置一些额外的东西才能在您的 initializeApp 方法中工作

 Platform.isAndroid? await Firebase.initializeApp():await Firebase.initializeApp(
        // Replace with actual values
        options: const FirebaseOptions(
          apiKey: "your api key from firebase console here ",
          appId: "your apid from firebase console here",
          messagingSenderId: "XXX",
          projectId: "your project id",
        ),
      );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Troubleshooting Dart XMLHttpRequest error - works for Flutter mobile, not for Flutter web - Troubleshooting Dart XMLHttpRequest error - works for Flutter mobile, not for Flutter web firebase-js-sdk v9 不适用于本机反应? 错误:尝试解析模块“idb”时 - firebase-js-sdk v9 doesn't work with react native? Error: While trying to resolve module `idb` 从 Node js 调用 Flutter web 应用程序 function ZBF12E1515C25C7D8A15AB2F14Z13 - Call Flutter web app from Node js function firebase Firebase Firestore 自定义同步规则 | Flutter - Dart - Firebase Firestore custom sync rules | Flutter - Dart 错误:断言失败:file:///C:/Users/Asus/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.1/lib/src/firebase_core_web.dart:207:11 - Error: Assertionfailed: file:///C:/Users/Asus/flutter/.pub-cache/hosted/pub.dartlang.org/firebase_core_web-1.7.1/lib/src/firebase_core_web.dart:207:11 为什么 firebase 不能与 flutter web 一起使用? - Why firebase not working with flutter web? FireBase 存储在 flutter web - FireBase Storage in flutter web Dart Flutter 顺序 firebase_auth 错误 - Dart Flutter sequential firebase_auth errors Firebase 令牌未在 flutter web 中生成 - Firebase token not generated in flutter web Not able to fetch data from Firebase Firestore SHOWS ERROR in NEXT.JS using Firebase SDK Firebase v9 - Not able to fetch data from Firebase Firestore SHOWS ERROR in NEXT.JS using Firebase SDK Firebase v9
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM