简体   繁体   中英

Flutter, Firebase: retrieving data from firebase

I have a question. I have an app that allows users to save posts by clicking an icon. Posts are saved in Firebase inside a collection called "saved", this collection is inside another collection called "posts". This is a saved sample post:

图片

Here is an example of an unsaved post:

图片

The question is, how do I retrieve only the saved posts?

Any sample code you write can help me, or even suggest an idea.

you can achieve your goal by multiple ways, but I think since you are trying to get all collections in your database that is names saved , consider trying Collection Group it would help get all documents inside any saved collection in your database, for more information you can check: https://firebase.google.com/docs/firestore/query-data/queries#collection-group-query

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM