Flutter web: tried to call a non-function, such as null: 'dart.global.firebase.storage

前端 未结 1 1002
天命终不由人
天命终不由人 2021-01-17 20:32

Im using Firebase plugin for web and managed to work with firestore and authentication. Now, Im trying to enable firebase storage but when i instanciate Storage gives me thi

相关标签:
1条回答
  • 2021-01-17 20:57

    Solved!

    In index.html add the latest version of firebase storage:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title></title>
    
        <script src="https://www.gstatic.com/firebasejs/6.3.1/firebase-app.js"></script>
        <script src="https://www.gstatic.com/firebasejs/6.3.1/firebase-firestore.js"></script>
        <script src="https://www.gstatic.com/firebasejs/6.3.1/firebase-auth.js"></script>
        <script src="https://www.gstatic.com/firebasejs/6.3.1/firebase-storage.js"></script>
        <script defer src="main.dart.js" type="application/javascript"></script>
    </head>
    <body>
    </body>
    </html>
    

    In yourClass.dart :

    import 'package:firebase/firebase.dart' as fb;
    
      fb.StorageReference _ref = fb.storage().ref('images');
    
    0 讨论(0)
提交回复
热议问题