Reputation: 3019
I need to disable firebase app read/write for a week and user firebase cache, then enable it for updating user info and then disable it until next week, is it possible?
Upvotes: 0
Views: 877
Reputation: 3019
We can specify the source of getting data from server or cache or server first:
Source.cache
: get data from the cache
Source.server
: get data from the server
Source.serverAndCache
: (Default) get data from the server first
Firestore.instance
.collection("user")
.getDocuments(source: Source.cache)
.then((querySnapshot) {
querySnapshot.documents.forEach((doc) {
print("get document from cache: " + doc.toString());
});
});
You can even check if your data is from cache or server:
querySnapshot.metadata.isFromCache;
Upvotes: 1