title: How to retrieve an image from Firestore database - Flutter
body: <p>i was wondering how to retrieve an image from Firestore, i was trying and reading and watching tutorials so i have come with this solution:</p>
  <p>1- Upload images to Firebase storage.</p>
  <p>2- Go to Firestore create a collection and a document with field name and value of image path. ( collection &quot;majorChallenges&quot;, doc &quot;challenge-1&quot;, field &quot;source&quot;, value &quot;image path url&quot;)</p>
  <p>3- Initiate a Firestore Instance:  <code>var _fireStoreInstance = FirebaseFirestore.instance;</code></p>
  <p>4- Access the Database collection using QuerySnapshot: <code>QuerySnapshot qn = await _fireStoreInstance.collection(&quot;majorChallenges&quot;).get();</code></p>
  <p>5- now after that am not sure how to setState, initState, return and display the image inside Scaffold or Container.</p>
  <p>some tutorials are using the image link or name which is not efficient for me what if i have to change the image in the future so the best solution i believe must not use the image name it should access the collection and the doc and retrieve the image path.</p>
  <p>i already set up the read and write permissions and i have accessed the database before to retrieve text so no authorisation problems, I would be very thankful if someone could complete the steps for us</p>