I'm trying to use Firebase in my flutter web project.
But app can't be run with this message.
TypeError: dart.global.firebase.firestore is not a function at Object.firestore$ [as firestore]
My index.html
looks like this.
<script src="https://www.gstatic.com/firebasejs/7.17.1/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/7.17.1/firebase-analytics.js"></script> <script> // Your web app's Firebase configuration var firebaseConfig = { apiKey: "MY_API_KEY", authDomain: "MY_AUTHDOMAIN", databaseURL: "MY_URL", projectId: "MY_ID", storageBucket: "MY_BUCKET", messagingSenderId: "MY_ID", appId: "MY_APPID", measurementId: "MY_ID" }; // Initialize Firebase firebase.initializeApp(firebaseConfig); firebase.analytics(); </script>
Anyone knows how to fix this?
As mentioned in the docs, add this line in index.html
:
<script src="https://www.gstatic.com/firebasejs/8.6.1/firebase-firestore.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With