Flutter web: tried to call a non-function, such as null: 'dart.global.firebase.storage
6,532
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');
Author by
M.Ali
Updated on December 12, 2022Comments
-
M.Ali over 1 year
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 this error
tried to call a non-function, such as null: 'dart.global.firebase.storage
for firestore and authentication I use :
import 'package:firebase/firebase.dart' as fb; import 'package:firebase/firestore.dart'; fb.Auth _firebaseAuth = fb.auth(); Firestore _firestore =fb.firestore();
for Storage :
fb.Storage storage = fb.storage();
-
Natesh bhat about 4 yearsPlease answer my question here : stackoverflow.com/questions/60832658/…
-
Mateen Kiani over 3 yearsMake sure you have same version of all the scripts.