5

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>

2 Answers 2

11

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>
...
Sign up to request clarification or add additional context in comments.

Comments

-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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.