Flutter 颤振Web错误类型错误:dart.global.firebase.analytics不是一个函数

Flutter 颤振Web错误类型错误:dart.global.firebase.analytics不是一个函数,flutter,dart,visual-studio-code,flutter-web,Flutter,Dart,Visual Studio Code,Flutter Web,我使用的是以前创建的firebase移动应用程序,该应用程序在移动级别上与firebase完全兼容,但是,当我尝试将其作为chrome页面运行时,它似乎不起作用,并且在编译时会触发标题中列出的错误。颤振医生显示一切正常工作,铬是一个上市的设备。当试图构建网页时,chrome窗口中会出现一个空白屏幕 TypeError: dart.global.firebase.analytics is not a function at Object.analytics$ [as analytics]

我使用的是以前创建的firebase移动应用程序,该应用程序在移动级别上与firebase完全兼容,但是,当我尝试将其作为chrome页面运行时,它似乎不起作用,并且在编译时会触发标题中列出的错误。颤振医生显示一切正常工作,铬是一个上市的设备。当试图构建网页时,chrome窗口中会出现一个空白屏幕

TypeError: dart.global.firebase.analytics is not a function
    at Object.analytics$ [as analytics] (http://localhost:59823/packages/firebase/src/top_level.dart.lib.js:114:102)
    at new firebase_analytics_web.FirebaseAnalyticsWeb.new (http://localhost:59823/packages/firebase_analytics_web/firebase_analytics_web.dart.lib.js:70:64)
    at Function.registerWith (http://localhost:59823/packages/firebase_analytics_web/firebase_analytics_web.dart.lib.js:29:82)
    at Object.registerPlugins (http://localhost:59823/packages/reminder_application/generated_plugin_registrant.dart.lib.js:23:49)
    at main (http://localhost:59823/web_entrypoint.dart.lib.js:34:35)
    at main.next (<anonymous>)
    at runBody (http://localhost:59823/dart_sdk.js:39260:34)
    at Object._async [as async] (http://localhost:59823/dart_sdk.js:39291:7)
    at main$ (http://localhost:59823/web_entrypoint.dart.lib.js:33:18)
    at http://localhost:59823/main_module.bootstrap.js:19:10
    at Array.forEach (<anonymous>)
    at window.$dartRunMain (http://localhost:59823/main_module.bootstrap.js:18:32)
    at <anonymous>:1:8
    at Object.runMain (http://localhost:59823/dwds/src/injected/client.js:8824:21)
    at http://localhost:59823/dwds/src/injected/client.js:22712:19
    at _wrapJsFunctionForAsync_closure.$protected (http://localhost:59823/dwds/src/injected/client.js:3850:15)
    at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:59823/dwds/src/injected/client.js:11062:12)
    at Object._asyncStartSync (http://localhost:59823/dwds/src/injected/client.js:3814:20)
    at main__closure1.$call$body$main__closure (http://localhost:59823/dwds/src/injected/client.js:22724:16)
    at main__closure1.call$1 (http://localhost:59823/dwds/src/injected/client.js:22651:19)
    at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:59823/dwds/src/injected/client.js:4184:16)
    at _CustomZone.runUnary$2$2 (http://localhost:59823/dwds/src/injected/client.js:12435:39)
    at _CustomZone.runUnaryGuarded$1$2 (http://localhost:59823/dwds/src/injected/client.js:12382:14)
    at _ControllerSubscription._sendData$1 (http://localhost:59823/dwds/src/injected/client.js:11958:19)
    at _DelayedData.perform$1 (http://localhost:59823/dwds/src/injected/client.js:12147:59)
    at _PendingEvents_schedule_closure.call$0 (http://localhost:59823/dwds/src/injected/client.js:12196:14)
    at Object._microtaskLoop (http://localhost:59823/dwds/src/injected/client.js:4022:24)
    at StaticClosure._startMicrotaskLoop (http://localhost:59823/dwds/src/injected/client.js:4028:11)
    at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (http://localhost:59823/dwds/src/injected/client.js:10931:9)
    at invokeClosure (http://localhost:59823/dwds/src/injected/client.js:1258:26)
    at MutationObserver.<anonymous> (http://localhost:59823/dwds/src/injected/client.js:1277:18)``` 
TypeError:dart.global.firebase.analytics不是一个函数
在Object.analytics$[作为分析](http://localhost:59823/packages/firebase/src/top_level.dart.lib.js:114:102)
在new firebase_analytics_web.firebase analytics web.new(http://localhost:59823/packages/firebase_analytics_web/firebase_analytics_web.dart.lib.js:70:64)
在Function.registerWith处(http://localhost:59823/packages/firebase_analytics_web/firebase_analytics_web.dart.lib.js:29:82)
在Object.registerPlugins(http://localhost:59823/packages/reminder_application/generated_plugin_registrant.dart.lib.js:23:49)
大体上(http://localhost:59823/web_entrypoint.dart.lib.js:34:35)
在main.next()
在runBody(http://localhost:59823/dart_sdk.js:39260:34)
at对象。\u异步[作为异步](http://localhost:59823/dart_sdk.js:39291:7)
主要是美元(http://localhost:59823/web_entrypoint.dart.lib.js:33:18)
在http://localhost:59823/main_module.bootstrap.js:19:10
在Array.forEach()处
在窗口。$dartRunMain(http://localhost:59823/main_module.bootstrap.js:18:32)
时间:1:8
在Object.runMain(http://localhost:59823/dwds/src/injected/client.js:8824:21)
在http://localhost:59823/dwds/src/injected/client.js:22712:19
at_wrapJsFunctionForAsync_闭包。$protected(http://localhost:59823/dwds/src/injected/client.js:3850:15)
在wrapJsFunctionForAsync_Close.呼叫$2(http://localhost:59823/dwds/src/injected/client.js:11062:12)
在对象上。\u asyncStartSync(http://localhost:59823/dwds/src/injected/client.js:3814:20)
在main_uuclosure1.$call$body$main_uclosure(http://localhost:59823/dwds/src/injected/client.js:22724:16)
在主楼1.打1美元(http://localhost:59823/dwds/src/injected/client.js:22651:19)
在StaticClosure.\u rootRunUnary[作为调用$2$5](http://localhost:59823/dwds/src/injected/client.js:4184:16)
在_CustomZone.一元人民币$2$2(http://localhost:59823/dwds/src/injected/client.js:12435:39)
在_CustomZone.rununaryarcarded$1$2(http://localhost:59823/dwds/src/injected/client.js:12382:14)
在_ControllerSubscription._发送数据$1(http://localhost:59823/dwds/src/injected/client.js:11958:19)
在_DelayedData.执行$1(http://localhost:59823/dwds/src/injected/client.js:12147:59)
在_PendingEvents _schedule _close.呼叫$0(http://localhost:59823/dwds/src/injected/client.js:12196:14)
在对象上。\u微任务循环(http://localhost:59823/dwds/src/injected/client.js:4022:24)
静态关闭时。\u开始微任务循环(http://localhost:59823/dwds/src/injected/client.js:4028:11)
在AsyncRun初始化ScheduleMiddate内部回调调用$1(http://localhost:59823/dwds/src/injected/client.js:10931:9)
重合闸时(http://localhost:59823/dwds/src/injected/client.js:1258:26)
在观察者处。(http://localhost:59823/dwds/src/injected/client.js:1277:18)``` 
在期望web安装正常工作之前,您需要遵循for web安装

将以下内容添加到
index.html
正文中:

<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.4.1/firebase-analytics.js"></script>

<script>
      var firebaseConfig = {
        apiKey: "...",
        authDomain: "[YOUR_PROJECT].firebaseapp.com",
        databaseURL: "https://[YOUR_PROJECT].firebaseio.com",
        projectId: "[YOUR_PROJECT]",
        storageBucket: "[YOUR_PROJECT].appspot.com",
        messagingSenderId: "...",
        appId: "1:...:web:...",
        measurementId: "G-...",
      };

      // Initialize Firebase
      firebase.initializeApp(firebaseConfig);
</script>

var firebaseConfig={
apiKey:“…”,
authDomain:“[YOUR_PROJECT].firebaseapp.com”,
databaseURL:“https://[YOUR_PROJECT].firebaseio.com”,
projectId:“[YOUR_PROJECT]”,
storageBucket:“[YOUR_PROJECT].appspot.com”,
messagingSenderId:“…”,
appId:“1:…:web:…”,
度量标准:“G-…”,
};
//初始化Firebase
firebase.initializeApp(firebaseConfig);
您需要为您使用的每个SDK添加脚本。以上仅显示了分析的基础知识