Flutter如何禁用firebase应用程序网络读/写一周



我需要禁用firebase应用程序读/写一周和用户firebase缓存,然后启用它来更新用户信息,然后禁用它直到下周,这可能吗?

我们可以首先指定从服务器、缓存或服务器获取数据的来源:

Source.cache:从缓存中获取数据Source.server:从服务器获取数据Source.serverAndCache:(默认(首先从服务器获取数据

Firestore.instance
.collection("user")
.getDocuments(source: Source.cache)
.then((querySnapshot) {
querySnapshot.documents.forEach((doc) {
print("get document from cache: " + doc.toString());
});
});

您甚至可以检查您的数据是否来自缓存或服务器:

querySnapshot.metadata.isFromCache;

最新更新