googlearchive / firebase-dart

Dart wrapper for Firebase
https://pub.dev/packages/firebase
404 stars 144 forks source link

firebase-storage: Just get metadata once #357

Closed Neifen closed 3 years ago

Neifen commented 3 years ago

So I was using the firebase package to download data from the firebase-storage (with flutter on web) and was trying to get two information: first the FullMetadata and second the download-URL.

For both I am using the Firebase-Storage-Reference like this:

var reference = firebaseb.app().storage().refFromURL("gs://blabla").child("myfilename")

I then use the reference above and .getMetadata() for the metadata and .getDownloadURL()for the download-URL. I then really quickly realized how slow my page was when loading my images. I then turned to the chrome-developer tool in the network tab and realized that both calls:

  1. need 500ms to get done (is it because I have a free firebase account?)
  2. they do the same exact call. (The download links is basically the child reference + ?alt=media and the the download token that is in the metadata.

So now my main question is: is it supposed to be like that? Is there a clean way to save half a second per image to get all this information other than creating my own url from the metadata? I saw that there was a getDownloadUrl function in the Metadata object but it's now deprecated.

Thank you for your help

kevmoo commented 3 years ago

We're just a wrapper over the JS API. I'd suggest asking in a firebase-focused channel. 🤷 Good luck!