How to retrieve data from firestore in flutter? | Using StreamBuilder and QuerySnapshot | Firebase

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in the last video we learned how to save data in this video learn how to display save data use these dependencies import these packages initialize Firebase in firestore using this client collection client details we are displaying data using stream Builder stream Builder rebuild for every new events stream Builder listen to event flowing from the Stream for every new event it will rebuild type query snapshot query snapshot contains the result of a query start by giving stream Builder a stream firebasefirestore.instance.collection client is our collection name snapshots then write the Builder given a snapshot declare what should this part of your app look like context snapshot declare a row widget list client widgets then we return the created widget list list View children client widgets then here we create a row that contains client details list view is rapid expanded for avoiding overflow error okay first we check the snapshot has data then assigned to a variable client snapshot.data.docs reverse to list then retrieve each data using the foreign Loop and add to a row widget VAR client and clients add null check client widget equals row children text widget then add client name client of field name is name then email mobile main access alignment space between add each client widget in client widgets list client widgets.add client widget then return to client widgets then run the app data displayed add a new data it displayed here we need to clear this after saving the client data clear the controllers in here then run the app then clear all data and enter data thank you for watching
Info
Channel: True Coders
Views: 17,550
Rating: undefined out of 5
Keywords: snap shot, stream builder, fire base, fire store, flutter
Id: YUrJsonOeg4
Channel Id: undefined
Length: 8min 13sec (493 seconds)
Published: Sat Feb 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.