Giter VIP home page Giter VIP logo

Comments (6)

russellwheatley avatar russellwheatley commented on June 3, 2024 1

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

russellwheatley avatar russellwheatley commented on June 3, 2024 1

Have you ran flutter clean? This is almost certainly a problem with your setup. Follow the storage example to help you.

from flutterfire.

russellwheatley avatar russellwheatley commented on June 3, 2024

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.

Sarathlal13 avatar Sarathlal13 commented on June 3, 2024

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.

Sarathlal13 avatar Sarathlal13 commented on June 3, 2024

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.

Sarathlal13 avatar Sarathlal13 commented on June 3, 2024

Thanks, the issue has been resolved.

from flutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.