0

I found the two ways to fetch images from firebase storage.

  1. Using imagePath

When saving an image to storage, store that image path to firestore, and when fetching the image, use that image path from firestore and call FirebaseStorage instance.

// In this case, get & post imagePath info String through firebase firestore FirebaseStorage.instance.storage.ref().child('imagePath').getData() 
  1. Using image url

When saving an image to storage, store that image url to firestore, and when fetching the image, use that image url from firestore as network image (no need to call FirebaseStorage instance).

// In this case, get & post imageUrl String through firebase firestore Firestore.instance.collection('images').document('foo').get() 

Which one would be the better way? Is there any performance difference?

1 Answer 1

1

The first fragment retrieves image data from Cloud Storage through the Firebase SDK for that product. Cloud Storage is a solution for storing blog/file data, at any scale.

The second fragment retrieves image data from Cloud Firestore through the Firebase SDK for that product. Firestore is a NoSQL database, and also works at any scale.

Cloud Storage and Cloud Firestore are completely different products, and you'll have to choose yourself which one to use. But the general guidance would be to store unstructured data into Storage, and more structured data in Firestore.

Sign up to request clarification or add additional context in comments.

1 Comment

I understand the difference between Storage and Firestore, I updated my question

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.