skip to Main Content

I am building a social media app as a way to learn the basics of Flutter. I have made a way to upload a post, and it uploads data into my Firebase Realtime database like this:

-Posts
    postid
        imageurl
        uid
        uemail
        uname
    postid
        etc

How should I go about loading this data into a ListView and displaying the username and the image for each post? I have only done this with a recyclerview in Android in the past.

2

Answers


  1. Chosen as BEST ANSWER

    If anybody else is trying to figure this out, I ended up following this tutorial, and it was very helpful! It uses a StreamBuilder to load data into a list, and it seems like a much more simple way to accomplish this than some of the other methods I looked into.


  2. You can traverse the post from the firebase store.

    FirebaseFirestore.instance.collection("Posts")
    .get()
    .then((value) {
          for (var doc in value.docs) {
            print("${doc.id} => ${doc.data()}");
          }
    }
    

    From the above code, you can get posts from firebase database

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search