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>
Before using FlutterFire on the web, you must first import the Firebase JavaScript SDK and initialize Firebase. The only way to currently add the Firebase SDKs to your Flutter web project is by importing the scripts from the Firebase content delivery network (CDN). Add the firebase-app.js script to your index.html file: ...
Not only the ones in the example. If you did it, and it is still not working it is because you need to add the CDN for the other services you are using. In my case they were firebase-auth.js and firebase-firestore.js.
You have to add ALL the CDN's you need from Firebase. Not only the ones in the example. If you did it, and it is still not working it is because you need to add the CDN for the other services you are using. In my case they were firebase-auth.js and firebase-firestore.js.
You can find the latest information on firebase.google.com: Before using FlutterFire on the web, you must first import the Firebase JavaScript SDK and initialize Firebase. The only way to currently add the Firebase SDKs to your Flutter web project is by importing the scripts from the Firebase content delivery network (CDN).
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>
...
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