Reputation: 53
I am building a web app in flutter trying to add photos to firebase storage.
I am having this error and most post say its solve by adding
https://www.gstatic.com/firebasejs/8.2.4/firebase-database.js"
but I have it
What else could be causing the TypeError: dart.global.firebase.storage is not a function
<body>
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/8.2.4/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.gstatic.com/firebasejs/8.2.4/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-firestore.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "",
measurementId: ""
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
</script>
Upvotes: 5
Views: 2985
Reputation: 1
Add this in index.html, it will work (see that you insert it in the right place)
..................
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<script src="https://www.gstatic.com/firebasejs/7.17.1/firebase-firestore.js"></script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
Upvotes: -1
Reputation: 203
I had the same issue and fixed it by adding the another script for firebase-storage
...
<script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.4/firebase-storage.js"></script>
...
Upvotes: 11