Flutter + Firebase - Upload Image File to Storage
First thing is that you need to do flutter clean
and then fire the flutter pub get
command and run your application your issue will solve.
And if still issue persists then do flutter clean
then restart your IDE
after that do flutter pub get
and run your application.
Saad Bashir
Updated on December 29, 2022Comments
-
Saad Bashir over 1 year
I am trying to upload an image file which I have got using imagepicker.
updatePhoto(user, File imageFile) async { FirebaseStorage storage = FirebaseStorage.instance; Reference ref = storage.ref().child('user/profile/${user.uid}'); UploadTask uploadTask = ref.putFile(imageFile); String url; uploadTask.whenComplete(() async { url = await ref.getDownloadURL(); }).catchError((onError) { print(onError); }); return url; }
But above code returns following error
VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: MissingPluginException(No implementation found for method Task#startPutFile on channel plugins.flutter.io/firebase_storage) #0 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:156 #1 new MethodChannelTask. (package:firebase_storage_platform_interface/src/method_channel/method_channel_task.dart) flutter: MissingPluginException(No implementation found for method Reference#getDownloadURL on channel plugins.flutter.io/firebase_storage)
I would appreciate if someone could help explain how to resolve this error. Thank you