Comments (6)
@Sarathlal13 - the scripts are auto-injected by the firebase_core plugin. Remove this code:
<script src="https://www.gstatic.com/firebasejs/9.9.1/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-storage.js"></script>
I have also provided the firebaseConfig as follows inside index.html
<script> var firebaseConfig = { // Your Firebase configuration goes here }; // Initialize Firebase firebase.initializeApp(firebaseConfig); </script>
See Storage example web/index.html
: https://github.com/firebase/flutterfire/blob/master/packages/firebase_storage/firebase_storage/example/web/index.html
from flutterfire.
Have you ran flutter clean
? This is almost certainly a problem with your setup. Follow the storage example to help you.
from flutterfire.
I tested your code (with slight updates so it would run) and I did not get the exception you are experiencing:
Reference ref = FirebaseStorage.instance.ref();
Reference dirRef = ref.child('flutter-tests');
Reference nameRef = dirRef.child('image-something');
final metadata = SettableMetadata(contentType: 'image/jpeg');
final usint = Uint8List(10);
final uploadTask = nameRef.putData(usint, metadata);
await uploadTask.whenComplete(() => print('completed'));
We're going to need an updated code reproduction to verify the bug. Thanks.
from flutterfire.
Thanks, I am encountering an exception from this first line: Reference ref = FirebaseStorage.instance.ref();. The remaining lines are not executing.
In my Firebase project, I added a Web app and in my main function, I included:
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(options: DefaultFirebaseOptions.web);
Additionally, in the web folder's index.html file, I included:
<script src="https://www.gstatic.com/firebasejs/9.9.1/firebase-app.js"></script> <script src="https://www.gstatic.com/firebasejs/9.15.0/firebase-storage.js"></script>I have also provided the firebaseConfig as follows inside index.html
<script> var firebaseConfig = { // Your Firebase configuration goes here }; // Initialize Firebase firebase.initializeApp(firebaseConfig); </script>Am I missing something in configuration ?
from flutterfire.
I removed the unwanted codes from index.html and also set up CORS as I saw in the example. Unfortunately, the error still persists. In the Chrome console, I'm getting...
js_helper.dart:1196 Uncaught TypeError: Instance of 'NullError': type 'NullError' is not a subtype of type 'JavaScriptObject'
at Object.wrapException (js_helper.dart:1196:37)
at Object._failedAsCheck (rti.dart:1385:3)
at Rti._generalAsCheckImplementation [as _as] (rti.dart:1363:3)
at Object._testException (_flutterfire_internals.dart:82:38)
at Object.guardWebExceptions (_flutterfire_internals.dart:152:10)
at Object.guard (errors.dart:20:3)
at FirebaseStorageWeb.ref$1 (firebase_storage_web.dart:101:12)
at firebase_storage.dart:102:30
at _wrapJsFunctionForAsync_closure.$protected (async_patch.dart:303:19)
at _wrapJsFunctionForAsync_closure.call$2 (async_patch.dart:328:23)
from flutterfire.
Thanks, the issue has been resolved.
from flutterfire.
Related Issues (20)
- storage: file storage with dynamic directory not visible in gcsfuse HOT 3
- [📚] Your documentation feedback title (CHANGE ME)
- cloud_firestore: iOS includeMetadataChanges does not recieve isFromCache false after first run HOT 14
- [firebase_auth]: [firebase_auth/unknown-error] An internal error has occurred. (when calling signinwithemailandpassword on windows) HOT 10
- [FileSystemEntity]: <Is it a bug? I can't read json file via File.readAsStringSync or File.readAsString> HOT 1
- [firebase_auth]: <Requests from this Android client application <empty> are blocked.> HOT 2
- FirebaseAuth.instance.currentUser always null on windows app flutter !! HOT 3
- Firebase Auth: reCaptcha shows up even after configuring Silent APN correctly HOT 2
- Google SignIn Crashing on iOS
- [firebase_core]: not working with cocoapods 1.15.2 HOT 8
- [BUG]: Error: Unable to get Xcode project information ... Unable to read project 'Runner.xcodeproj'. After Running Flutterfire Configure on MACOS HOT 1
- [firebase_messaging]: iOS Background receive Message HOT 2
- [firebase_core]: 'pod update' cannot be done when 'firebase core' is updated to the latest version HOT 5
- Lost connection to device in desktop flutter app Firebase Storage ! HOT 3
- [remote_config]: setConfigSettings on windows raises an exception HOT 1
- Problem with GoogleUtilities after Declaring :linkage => :static in Podfile HOT 3
- [📚] Your documentation feedback title (CHANGE ME)
- [Firebase auth]: about:blank page firebase auth verifyPhoneNumber HOT 3
- [firebaseAnalytics]: logScreenView doesn't send the name and class to GA4 in flutter web HOT 17
- [firestore]: Firestore snapshot does return empty data for existing doc HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterfire.