Upload images to Firebase storage from a Flutter app, and display them on the UI.

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ส.ค. 2022
  • In this video, you'll learn how to "Upload images to Firebase storage from a Flutter app and display them on a ListView"
    SOURCE CODE: github.com/gitanjal/flutterfi...
    Flutter + Firebase CRUD tutorial: • Flutter+Firebase begin...
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 134

  • @renadf9693
    @renadf9693 ปีที่แล้ว +9

    Thank you for this video, i was stuck and I watched many before I found it, it really helped me with my graduation project 🙏🏻🙏🏻❤️

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      Glad to know it helped! Stay connected.

    • @renadf9693
      @renadf9693 ปีที่แล้ว

      @@droidmonk4820 the problem is, while awaiting for the download URL to be ready, the user keep getting the “please upload an image” message, which would be confusing, any ideas of how to make the UX better?

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      Hi,
      You can display a loader during the process.
      You can declare a boolean to determine whether to display a loader.
      Then inside the onpressed function on starting the process of upload you can make the boolean true and call setState() and make that false again once upload is complete.
      Give it a try, and reach out if you face any difficulty.

    • @muhammadmohsinhussain5428
      @muhammadmohsinhussain5428 10 หลายเดือนก่อน

      Same issue was with me, but this person solved it.

  • @scary8619
    @scary8619 ปีที่แล้ว +2

    Bro, excelent video. Other youtube videos about upload photos to storage are outdated. Apart from that your explanations are wonderful. Greetings from Argentina!

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      I am glad that you liked the video, and thank you very much for your comment. Feeling motivated...

  • @TheArchaeus6
    @TheArchaeus6 ปีที่แล้ว

    Everything worked wonderfully to integrate into my app. Thank you for this tutorial good sir.

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Glad it helped, thanks for commenting. Stay connected.

  • @akasenju3605
    @akasenju3605 10 หลายเดือนก่อน

    thank you sooo much , i struggled so much with this image thing , you explained it very well

    • @droidmonk4820
      @droidmonk4820  10 หลายเดือนก่อน +1

      Glad it helped! Thanks for commenting, Stay connected.

  • @amvsekai
    @amvsekai ปีที่แล้ว +2

    explained pretty well and easy to understand!! Keep it up and thanks it really helped...

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      Glad you liked it. Thanks for commenting, stay connected.

  • @muhammadmohsinhussain5428
    @muhammadmohsinhussain5428 10 หลายเดือนก่อน

    Thanks a lot dear! The way you teach is much better then others.

  • @angelusvamp77
    @angelusvamp77 8 หลายเดือนก่อน

    I was stuck with this but this video really really helped me!!... Thank you very much!!

    • @droidmonk4820
      @droidmonk4820  8 หลายเดือนก่อน

      Glad it helped! Stay connected.

  • @MikeJones3
    @MikeJones3 ปีที่แล้ว

    Awesome video, super helpful for my app, thanks so much! 👍

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      I am happy to know it helped. Stay connected.

  • @aloysiusmichael1635
    @aloysiusmichael1635 2 หลายเดือนก่อน

    thx u very much bro, u are more meritorious than my lecturer who taught Flutter Firebase

    • @droidmonk4820
      @droidmonk4820  2 หลายเดือนก่อน

      Glad to know that my video helped, thanks for commenting . Stay connected.

  • @noxtube7937
    @noxtube7937 2 หลายเดือนก่อน

    Thank you brother for this ulpfull tutorial; you really solve my problem

    • @droidmonk4820
      @droidmonk4820  2 หลายเดือนก่อน

      Glad to know it helped. Stay connected.

  • @masterharith8488
    @masterharith8488 ปีที่แล้ว

    thanks this is really help me a lot, flutter tutorial doesnt have so much in youtube like other language

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Glad to know it helped 👍 Stay connected

  • @flutterkg
    @flutterkg ปีที่แล้ว

    Thanks you bro. From Kyrgyzstan

  • @loveleshagrahari3875
    @loveleshagrahari3875 11 หลายเดือนก่อน

    Sir I love your firebase playlist.

    • @droidmonk4820
      @droidmonk4820  11 หลายเดือนก่อน

      Glad to hear that. Stay connected.
      Thanks for commenting.

  • @popomin6538
    @popomin6538 ปีที่แล้ว

    Thank teacher for your video. Your video is so effective for me .Thank teacher 🙏

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Glad to hear it helped. Thanks and stay connected.

  • @richard2845
    @richard2845 9 หลายเดือนก่อน

    thanks for the tutorial and it's very clear

    • @droidmonk4820
      @droidmonk4820  9 หลายเดือนก่อน

      Glad to hear that! Stay connected.

  • @adeemmmm
    @adeemmmm ปีที่แล้ว

    Really awesome tutorial! Thank uu

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      Glad you liked it, stay connected.

  • @bbammjin
    @bbammjin ปีที่แล้ว

    Thank you! You solved my problem!👍👍

  • @mohamedabdel-tawab7887
    @mohamedabdel-tawab7887 ปีที่แล้ว

    The best video and best firebase playlist

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Thank you very much, Stay connected.

  • @brakdarany1616
    @brakdarany1616 6 หลายเดือนก่อน

    Amazing turtorial

    • @droidmonk4820
      @droidmonk4820  6 หลายเดือนก่อน

      Glad you liked. Stay connected.

  • @jdmoneymaker231
    @jdmoneymaker231 ปีที่แล้ว

    thank you mister , ur video is very useful

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Glad to hear that, thanks for commenting . Stay connected.

  • @khizarfarooqui2390
    @khizarfarooqui2390 ปีที่แล้ว +1

    it really helped me, thanks :)

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Happy to know that, stay connected

  • @JoshAnderson-ls3oq
    @JoshAnderson-ls3oq 10 หลายเดือนก่อน

    Super helpful thanks so much

    • @droidmonk4820
      @droidmonk4820  10 หลายเดือนก่อน

      Glad it helped!
      Thanks for commenting, Stay connected.

  • @TheRandomPerson49
    @TheRandomPerson49 ปีที่แล้ว

    very good explanation, Sir 💯👍

  • @MansiLakhani-xp6vp
    @MansiLakhani-xp6vp ปีที่แล้ว

    Excellent video ....

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Glad you liked it, Mansi. Stay connected.

  • @stutisaran8624
    @stutisaran8624 ปีที่แล้ว

    Thank you so much for the video. Its very detailed and comprehensive. However I seem to be getting this error when I try to run the app. "Error: The argument type 'Future
    Function()' can't be assigned to the parameter type 'Future Function(App)?'.
    - 'Future' is from 'dart:async'.
    - 'App' is from 'package:firebase_core_web/src/interop/app.dart'" Please help... :)

  • @user-lw4gl1kc9j
    @user-lw4gl1kc9j ปีที่แล้ว

    Thanks Man

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      You are welcome, Stay Connected.

  • @noikundesuka
    @noikundesuka 10 หลายเดือนก่อน

    what emu do you use?i use Pixel 4 api 33 and cant open camera

    • @droidmonk4820
      @droidmonk4820  10 หลายเดือนก่อน +1

      Hi @noikundesuka, In this video, I am not using an emulator, it's a real device. I am using the tool named Vysor to display it on the screen.

  • @chikwakatebe5577
    @chikwakatebe5577 ปีที่แล้ว

    Thank you so Much sir

  • @DMT-RITHMER
    @DMT-RITHMER 5 หลายเดือนก่อน

    mannn thank you so much

    • @droidmonk4820
      @droidmonk4820  5 หลายเดือนก่อน

      You're welcome!
      Thanks for the comment, Stay connected.

  • @dpxy1599
    @dpxy1599 10 หลายเดือนก่อน

    very helpful

    • @droidmonk4820
      @droidmonk4820  10 หลายเดือนก่อน

      Glad it helped. Thanks for commenting, STAY CONNECTED.

  • @Lakshadweep-d9l
    @Lakshadweep-d9l 10 หลายเดือนก่อน

    very nice

    • @droidmonk4820
      @droidmonk4820  10 หลายเดือนก่อน

      Thanks. Stay connected.

  • @bladycivilian
    @bladycivilian ปีที่แล้ว +1

    good tutorial

  • @arsyapermana1
    @arsyapermana1 ปีที่แล้ว

    thanks a lot 🙏

  • @interpreter5844
    @interpreter5844 ปีที่แล้ว

    Thankssss🖤

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      You are welcome, stay connected.

  • @mm-sf6qx
    @mm-sf6qx ปีที่แล้ว +1

    Thanks

  • @bladycivilian
    @bladycivilian ปีที่แล้ว

    this is probably the best explanation available for how to load and retrieve image on firebase storage. but one problem when we take a new camera picture, it overlaps the previous one because of same name 'name'. how to tackle that as we will not be able to call the previous image from firestore DB though the url get saved there but they all point to same picture in storage.

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      You can create a unique name for your file and create a reference with that name, you can use the current timestamp to create the unique name. I think I have mentioned that in the video!!!!
      And regarding accessing the file through its url, I have created a separate video on the topic. (th-cam.com/video/t0nWkruqFO4/w-d-xo.html)
      I hope this will help.

  • @MansiLakhani-xp6vp
    @MansiLakhani-xp6vp ปีที่แล้ว

    Plz help me - How to solve this error :
    Invalid argument(s): No host specified in URI file:

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      It seems you are passing wrong url somewhere. Once check the code where you are creating the reference, or any other places where you are using any URL.

  • @izanagi2014
    @izanagi2014 3 หลายเดือนก่อน

    Does anyone got this Error after trying to upload the image ?
    FirebaseException ([firebase_storage/no-bucket] No default storage bucket could be found

    • @droidmonk4820
      @droidmonk4820  3 หลายเดือนก่อน

      Here are some possible causes and solutions:
      Missing Firebase configuration: Ensure that you have properly configured Firebase in your Flutter project by following the setup instructions provided by Firebase. This includes adding the google-services.json file for Android or GoogleService-Info.plist for iOS to your Flutter project.
      Incorrect Firebase initialization: Make sure that you have initialized Firebase correctly in your Flutter app. This is usually done in the main.dart file using Firebase.initializeApp().
      Missing or incorrect bucket name: Double-check that you have specified the correct default storage bucket in your Firebase project settings. The bucket name should be in the format gs://your-project-id.appspot.com.
      Permissions issue: Ensure that the Firebase Storage service is enabled for your project and that the necessary permissions are set correctly. Check the Firebase console to verify the project settings.
      Network issues: Sometimes, network issues can also cause this error. Ensure that your device has a stable internet connection and can access Firebase services.
      Outdated Firebase SDK: Make sure you are using the latest version of the Firebase SDK for Flutter. You can check for updates using Flutter's package manager (pubspec.yaml).
      You can also try the solution of the link below:
      stackoverflow.com/questions/70763172/flutter-firebase-storage-not-woriking-no-default-bucket

  • @cats4ever272
    @cats4ever272 ปีที่แล้ว

    the code putfile(File(file.path) ..... File has an erorr says File is not a function

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      You may have imported a wrong library

  • @TungNguyen-lt5ej
    @TungNguyen-lt5ej ปีที่แล้ว

    I want to ask how to update when user selects another image, that image has to be updated both in Firebase storage and cloud firestore ?

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Yes, you have to update in both the places, and you'll also need to delete the existing file.

    • @TungNguyen-lt5ej
      @TungNguyen-lt5ej ปีที่แล้ว +1

      @@droidmonk4820 Can you make a video tutorial? Please!

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Sure, I'll let you know on this comment itself once I publish it.

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      th-cam.com/video/t0nWkruqFO4/w-d-xo.html
      Sorry for the delay, I hope you have already figured it out.

  • @felixtechmedia
    @felixtechmedia ปีที่แล้ว

    Hi! Very well explained video,! I'm not getting any errors but when I select the image in my iOS app, it doesn't follow through with creating the folder nor uploading the image. Any special config for iOS is necessary? Thanks!

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Hi,
      If it is not working then you should be able to find some information about the error in the log. If you can find it please share, it help in understanding the issue.
      Is it working in Android?
      Thanks for reaching out.

    • @felixtechmedia
      @felixtechmedia ปีที่แล้ว

      @@droidmonk4820 Hey! Thank you for the quick response. The issue is the following: flutter: Error caught: [firebase_storage/unauthorized] User is not authorized to perform the desired action.

  • @alicezuberg3233
    @alicezuberg3233 ปีที่แล้ว +1

    im getting an error in await referenceImageToUpload.putFile(File(file!.path)); i dont know why

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      What is the exact error you are getting?

    • @zanderv.l5607
      @zanderv.l5607 ปีที่แล้ว +2

      Go to your imports at the top make sure you have "import 'dart:io';" and if you have the html import that automatically got added by your IDE remove it.That worked for me

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      @@zanderv.l5607 Thanks for your suggestion, really appreciate it. I hope it helps Alice.

    • @BCS_KovidSharma
      @BCS_KovidSharma ปีที่แล้ว

      @@zanderv.l5607 Thanks dude

  • @mouhammadtoure3367
    @mouhammadtoure3367 ปีที่แล้ว

    Hello,
    When i click one of the items in order to display item details it show the following error
    : type null is not a subtype of type string flutter

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      The value you are passing to the details page is null for some reason. Try using the debugger or simply print the value that you are passing to the details page and verify it is correct.
      Also keep in mind: you will need to install firebase to you Flutter project before using Firebase services. (th-cam.com/video/kwLz-0e6Eo0/w-d-xo.html)

    • @mouhammadtoure3367
      @mouhammadtoure3367 ปีที่แล้ว

      Thx you for replying,
      Now it’s show me details page when i click on item but it show anything say Type Null is not a subtype of Map

    • @mouhammadtoure3367
      @mouhammadtoure3367 ปีที่แล้ว

      I’m using an android device

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      There may be two possible locations of error:
      1. Inside the details page, you may have defined a variable of type Map to hold the data that you pass from the list page. But some reason you passing null
      2. Inside the builder function of the FutureBuilder while getting the API response from snapshot.data. You may be getting null as the response. Check whether using the correct reference or not---
      _reference = FirebaseFirestore.instance.collection('shopping_list').doc(itemId);

  • @restaurantrecipebyhafsa
    @restaurantrecipebyhafsa 9 หลายเดือนก่อน

    when i clicked on the images in firebase it doesnot preview the image . kindly let me know how to preview images

    • @droidmonk4820
      @droidmonk4820  9 หลายเดือนก่อน

      On clicking the image the preview should appear on the right, and below the preview the file name appears, on clicking the file name the image is opened in a new tab.

    • @restaurantrecipebyhafsa
      @restaurantrecipebyhafsa 9 หลายเดือนก่อน

      @@droidmonk4820 but its not shoing on right and also not op3ning jn new tab rather it is downloading when i clicked on the name of image

  • @alicezuberg3233
    @alicezuberg3233 ปีที่แล้ว

    can you do that in realtime database sir? badly needed it

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      I shall create for sure, but I'll take some time. Stay connected.

  • @mariamboghdady3946
    @mariamboghdady3946 ปีที่แล้ว

    that is a very useful video but i have an error which catched by try & catch which said (Unsupported operation: Platform._operatingSystem) can you please help me

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      On which platform are you running the app- Android/iOS/Web ?

    • @mariamboghdady3946
      @mariamboghdady3946 ปีที่แล้ว

      @@droidmonk4820 web

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      I'll try to replicate it and let you know if I can find out the issue.

    • @ricardoaguilar-santoyo3765
      @ricardoaguilar-santoyo3765 ปีที่แล้ว

      I had the same issue, I fixed it by making sure I had the import import 'dart:io'; , and instead of try catch blocks I had to make if (!kIsWeb) {} and if(kIsWeb) conditions first. KisWeb are conditional to let your code know if you're running on a web app or an android/iOS application. inside these blocks you can add the try and catch methods.

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Hi Mariam, I am extremely sorry as I could not explore the issue you had, in time. I hope Ricardo's solution helps. Thanks Ricardo.

  • @artem-ai
    @artem-ai ปีที่แล้ว

    Thank you very much for the lesson. Do you have a lesson on how to upload videos? Not photos, but videos.

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Not yet, I shall try to create one.
      And thanks for commenting, stay connected.

    • @artem-ai
      @artem-ai ปีที่แล้ว

      @@droidmonk4820 ok, bro💪🏻

  • @VirtualEducationLYF-dd1lh
    @VirtualEducationLYF-dd1lh 3 หลายเดือนก่อน

    it show error bro:Unhandled Exception: [firebase_storage/no-bucket] No default storage bucket could be found. Ensure you have correctly followed the Getting Started guide. anyone clear this problem

    • @droidmonk4820
      @droidmonk4820  3 หลายเดือนก่อน

      Here are some possible causes and solutions:
      Missing Firebase configuration: Ensure that you have properly configured Firebase in your Flutter project by following the setup instructions provided by Firebase. This includes adding the google-services.json file for Android or GoogleService-Info.plist for iOS to your Flutter project.
      Incorrect Firebase initialization: Make sure that you have initialized Firebase correctly in your Flutter app. This is usually done in the main.dart file using Firebase.initializeApp().
      Missing or incorrect bucket name: Double-check that you have specified the correct default storage bucket in your Firebase project settings. The bucket name should be in the format gs://your-project-id.appspot.com.
      Permissions issue: Ensure that the Firebase Storage service is enabled for your project and that the necessary permissions are set correctly. Check the Firebase console to verify the project settings.
      Network issues: Sometimes, network issues can also cause this error. Ensure that your device has a stable internet connection and can access Firebase services.
      Outdated Firebase SDK: Make sure you are using the latest version of the Firebase SDK for Flutter. You can check for updates using Flutter's package manager (pubspec.yaml).
      You can also try the solution of the link below:
      stackoverflow.com/questions/70763172/flutter-firebase-storage-not-woriking-no-default-bucket

  • @Rajesh-sk5jc
    @Rajesh-sk5jc ปีที่แล้ว

    imageUrl is not getting url ?

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Hi Rajesh,
      please verify whether you are using the correct field name while parsing the data , and that you have a value for the field in the corresponding firestore document.

    • @Rajesh-sk5jc
      @Rajesh-sk5jc ปีที่แล้ว

      @@droidmonk4820
      ImagePicker imagePicker = ImagePicker();
      XFile? file = await imagePicker.pickImage(
      source: ImageSource.gallery);
      print('image path ${file!.path}');
      if (file == null) return;
      String UniqueFileName =
      DateTime.now().millisecondsSinceEpoch.toString();
      Reference referenceRoot = FirebaseStorage.instance.ref();
      Reference referenceDirImages =
      referenceRoot.child('images');
      Reference referenceImageUpload =
      referenceDirImages.child(UniqueFileName);

      try {

      //store the file
      await referenceImageUpload.putFile(File(file.path));
      //print(referenceImageUpload.getDownloadURL());
      imageUrl = await referenceImageUpload.getDownloadURL();
      } catch (error) {
      print(error);
      }

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Take a look at the console , check if you have got any error message.

  • @-julie-4882
    @-julie-4882 หลายเดือนก่อน

    unfortunately, that doesn't work in web app :(

    • @droidmonk4820
      @droidmonk4820  หลายเดือนก่อน

      What error do you get?
      Can you share some info from the stack trace!

  • @ahmedrehan7812
    @ahmedrehan7812 ปีที่แล้ว

    can you upload the src code please

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว +1

      Take a look at the branch upload_image of the repository below.
      github.com/gitanjal/flutterfirebasedemo/tree/upload_image
      Thanks for commenting bro, I forgot to add the link.

    • @ahmedrehan7812
      @ahmedrehan7812 ปีที่แล้ว +1

      @@droidmonk4820 thanks

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Stay connected, next video will be published by tomorrow.

    • @antoinegirgis3582
      @antoinegirgis3582 ปีที่แล้ว

      اخ ليااااااا

  • @TijnVeenhoven
    @TijnVeenhoven ปีที่แล้ว

    8:39

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Hi, Is there anything specific at this timestamp?

    • @TijnVeenhoven
      @TijnVeenhoven ปีที่แล้ว +1

      @@droidmonk4820 Oh no just for personal reference where I left off. Thank you!

    • @droidmonk4820
      @droidmonk4820  ปีที่แล้ว

      Cool.
      Stay connected.