1
votes

Based on this page FlutterFire should support Firebase Cloud Storage on web. However, when I init FlutterFire and then run the following code I get an error:

import 'package:firebase_storage/firebase_storage.dart';

...
await store.ref().child(storePath).child(newId).putData(imageData,);

The error is:

Uncaught (in promise) Error: MissingPluginException(No implementation found for method Task#startPutData on channel plugins.flutter.io/firebase_storage)
at Object.throw_ [as throw] (errors.dart:216)

This is the setup I have in index.html:

<script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-firestore.js"></script>>
<script src="https://www.gstatic.com/firebasejs/7.24.0/firebase-storage.js"></script>

<script>
var firebaseConfig = {
  apiKey: "sdjsdlksksd", //random strings not actual values
  authDomain: "sdsdkldskldsk",
  databaseURL: "https://askjskdjkd.com",
  projectId: "sdisdkjk",
  storageBucket: "dklsjfkldsfjlkdsjk",
  appId: "1:dghjqwkdwwqo;kewijdkjw",
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();

And in pubspec.yaml:

firebase_storage: ^5.0.1

Any idea what might be causing the error? Is it really a bug? Any workaround?

1

1 Answers

1
votes

try to add core firebase plugin for dart like this :

firebase: ^7.3.2

now use firebase storage like this :

import 'package:firebase/firebase.dart' as fb;

final storageRef = fb.storage().ref('$folderName/$filname');