Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Downloading Files from firebase storage to flutter

I have seen several examples regarding uploading a document in firebase storage but there is no document of downloading a list of files from firebase storage to flutter. On Firebase docs, there is a lot of documentation on firebase storage for Android, iOS, web, c++ etc. but not flutter. Specially if I Talk about Video's

VideoPlayerController videoPlayerController;
  @override
  void initState() {

    videoPlayerController = VideoPlayerController.network('/* Download Url*/');
    super.initState();
  }

Video's needs Url in the initialization of the app

like image 262
Vibhu Vardhan Singh Avatar asked Oct 22 '25 14:10

Vibhu Vardhan Singh


1 Answers

To find an example of uploading and downloading file to Cloud Storage from Flutter, have a look at the example application of the FlutterFire library firebase_storage.

The process mostly consists of getting a download URL, which gives you read-only access to the file:

final String url = await ref.getDownloadURL();

And then loading the data from that URL with:

final http.Response downloadData = await http.get(url);

Check out the _downloadFile method for the full example.

like image 156
Frank van Puffelen Avatar answered Oct 25 '25 05:10

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!