Abhishek Kumar
Abhishek Kumar

Reputation: 331

Having problems in retrieving data from Cloud Firestore in my Flutter App?

Let me illustrate my problem first,

I have three collections in my cloud Firestore 'followers', 'posts' and 'timeline'. (1) 'followers' contain all those user id's whom I am following followers collection (2) 'posts' contain all the information which the particular user has posted. posts collection (3) 'timeline' contain all the posts of the users whom I am following. timeline collection

My problem is that how can I implement timeline collection in flutter ? I am not able to filter information which I want to include in my flutter App. I want help on this part.

Thanks

Upvotes: 0

Views: 106

Answers (1)

JoaoCostaIFG
JoaoCostaIFG

Reputation: 171

Keeping a timeline like that on the firestore is probably something you don't want. Everytime a user makes a post you have to find all users that are following him and update their timeline too, which will result in a lot of duplicated information and wasted processing power.

You'll probably have better results if you "generate" the timeline inside the app for each user, e.g.: when the user signs in, you fetch all the posts (or maybe just the first 50 or something) of the users he's following

Upvotes: 1

Related Questions