1

I am currently creating an app with FlutterFlow that loads various daily news items from Firestore.

Each daily message is structured in Firestore like this:

  • Title (String)
  • Description (String)
  • Image (Image)
  • Content (Array)
    • Type (String) [Text, Image or PageBreak]
    • Value (String)

The content array is very filled with many texts and images.

Readers should receive only a certain part of the content array. Once they have read this part, the next button must be clicked. Only then will more content be loaded.

I want to use FlutterFlow to load different entries from the array to a unit, up to the type PageBreak.

Then the readers should press the Next button and the next part of the content, up to the next type PageBreak, will be loaded.

Currently, the whole content is loaded. This and also Infinity Scroll are no options for me.

Has anyone had a similar problem before or can help me with this? Thanks in advance :)

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
Luigi
  • 21
  • 4

1 Answers1

1

When you perform a query in Firestore using the client SDK for web, iOS, or Android, you get as a result full documents. There is no way you can only get a slice of a document. So you cannot get only a portion of the Content array, it's the entire document or nothing.

If you don't want to download the entire document with the Content array, then you should get that array out of the document, and create a separate document for each part of the array. Then you can simply paginate the results.

If you need to paginate the data that exists inside the Content array, without creating additional documents, then you have to create such a mechanism yourself based on the constraints you want.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
  • Thank you for the answer. I was not aware that it is not possible to load individual properties of a document. Unfortunately, this still does not solve my problem. If someone else has an idea, I would be very grateful to the person :) – Luigi Jun 27 '23 at 05:18
  • I have provided you with two solutions for solving your problem. Why do you say that it doesn't solve the problem? – Alex Mamo Jun 28 '23 at 10:37
  • Hey, lanzaldo. Did my answer help? Can I help you with other information? – Alex Mamo Jul 10 '23 at 05:33