[英]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.