Flutter Web和Firebase身份验证TypeError(无法读取未定义的属性'app')

蹉跎莫遣韶光老,人生唯有读书好。这篇文章主要讲述Flutter Web和Firebase身份验证TypeError:无法读取未定义的属性' app' 相关的知识,希望能为你提供帮助。
有人可以帮我吗?我尝试使用Flutter基于Google Firebase Auth和Cloud Firestore构建Web应用程序。 android上的项目运行良好,我可以与用户合作,并且可以从Cloud Firestore数据库中获取数据。我已经制作了第二个应用程序(webapp),执行Firebase文档中描述的所有步骤(webapp已注册,托管在Firebase上),并将所有依赖项插入pubspec.yaml

dependencies: flutter: sdk: flutter# The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for ios style icons. cupertino_icons: ^0.1.3 firebase_core: ^0.4.4+3 firebase: ^7.3.0 firebase_auth: ^0.16.0

像这样修改index.html:
< body> < !-- The core Firebase JS SDK is always required and must be listed first --> < script src="https://www.songbingjia.com/__/firebase/7.14.3/firebase-app.js"> < /script> < !-- TODO: Add SDKs for Firebase products that you want to use https://firebase.google.com/docs/web/setup#available-libraries --> < script src="https://www.songbingjia.com/__/firebase/7.14.3/firebase-analytics.js"> < /script> < !-- Add Firebase products that you want to use --> < script src="http://img.readke.com/220519/1H0236000-2.jpg"> < /script> < script src="http://img.readke.com/220519/1H0234D5-3.jpg"> < /script> < !-- Initialize Firebase --> < script src="https://www.songbingjia.com/__/firebase/init.js"> < /script> < !-- This script installs service_worker.js to provide PWA functionality to application. For more information, see: https://developers.google.com/web/fundamentals/primers/service-workers --> < script> if ('serviceWorker' in navigator) { window.addEventListener('load', function () { navigator.serviceWorker.register('flutter_service_worker.js'); }); } < /script> < script> var firebaseConfig = { apiKey: "XXXXXXXXXX-6EL5qIBxWjurRQMcK3pf9W-o", authDomain: "xxxxxxxx.firebaseapp.com", databaseURL: "https://xxxxxxxx.firebaseio.com", projectId: "xxxxxxxx", storageBucket: "xxxxxxxx.appspot.com", messagingSenderId: "xxxxxxxx6198", appId: "1:xxxxxxxx16198:web:cde3457e8dc734d045d227", measurementId: "X-XXXXXXXXXX" }; firebase.initializeApp(firebaseConfig); firebase.auth(); firebase.analytics(); < /script> < script src="https://www.songbingjia.com/android/main.dart.js" type="application/javascript"> < /script> < /body>

但是当我尝试登录或注册时,Android Studio会抛出此错误消息:
TypeError: Cannot read property 'app' of undefined at Object.app$ [as app] (http://localhost:53262/packages/firebase/src/top_level.dart.lib.js:72:56) at firebase_auth_web.FirebaseAuthWeb.new.[_getAuth] (http://localhost:53262/packages/firebase_auth_web/firebase_auth_web.dart.lib.js:42:27) at firebase_auth_web.FirebaseAuthWeb.new.signInWithCredential (http://localhost:53262/packages/firebase_auth_web/firebase_auth_web.dart.lib.js:197:34) at signInWithCredential.next (< anonymous> ) at runBody (http://localhost:53262/dart_sdk.js:43135:34) at Object._async [as async] (http://localhost:53262/dart_sdk.js:43163:7) at firebase_auth_web.FirebaseAuthWeb.new.signInWithCredential (http://localhost:53262/packages/firebase_auth_web/firebase_auth_web.dart.lib.js:196:20) at firebase_auth.FirebaseAuth.__.signInWithCredential (http://localhost:53262/packages/firebase_auth/firebase_auth.dart.lib.js:324:90) at signInWithCredential.next (< anonymous> )

此异常是什么意思?我怎么了非常感谢您的帮助!
答案修复依赖项。这对我有帮助
【Flutter Web和Firebase身份验证TypeError(无法读取未定义的属性' app' )】依赖关系:扑:SDK:颤振firebase_auth:firebase_auth_web:

    推荐阅读