0

I'm building an education app using Flutter. My backend is Firebase Firestore. To make it short: I want the app to come with a pre-made database. Only if it's version is different from firestore it will update.


This is my use context:

There are two types of data:

  1. Things that can be updated frequently: like user progress on each course.
  2. Things that should be loaded only once and are almost never updated: Assets like the image of each course, data of each type of substance.

I want to load a bunch of assets of the second type when the app is installed. How can I make the basics go "inside" the app, and only update when needed?

For example: I have a collection of chemical substances. I want the app to be already installed with some of them. If the cloud version differs from this local, pre-installed database (it can be marked with a timestamp, "last-changed"), then the app will call Firebase, and load stuff. Is this possible?


I've read this question. It looks like it's not possible but it's pretty old (7y).

The easiest way I can think is to upload this to a dedicated server and download from there using custom logic. But it looks dumb and (as it looks like) I have no prior experience with backend.

Am I fearing the Firestore readings too much and overengineering it?

Thank you.

Renan
  • 105
  • 8

1 Answers1

0

What you're describing is a perfect use-case for Firestore's data bundles feature. This allow you to create a bundle of Firestore documents/query results, that you can then include in the APK/API of your app, and load the bundle to Firestore's cache when the app is first started.

I also recommend checking out my answer here: How to save Offline Server Data in Application

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807