如果我使用firestore离线存储聊天应用程序的数据,我还需要sqlite,flutter吗
我想为我的朋友创建一个聊天应用程序,现在远程服务我将使用 firestore 和本地 sqlite,但我意识到 firestore 默认情况下会离线保存数据,所以我的问题是我有一些数据,例如消息或发送设置应用程序,是否可以将它们离线保存在 firestore 中,这似乎是自动的,无需额外费用。
I wanna create a chatapp for my friend, and now remote serve I will use firestore and locally sqlite, but I realized it is default for firestore to save data offline, so my question is I have some data like message, or sending setting for the app, is it ok just to save them in firestore offline which seems automatically and no extra costs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这取决于您想要或需要什么。
如果您只想使用离线持久性来存储,以防根本没有互联网。 Firebase 开箱即用地支持这一点。但您需要记住,打电话时要小心。因为在互联网连接速度较慢的情况下,如果您告诉 Firebase 访问等待在线行为。它不会首先使用本地,您可能无法显示数据。 在此处查看问题
此外,如果您想使用 Firebase 的离线持久性,请注意数据大小的默认值40 兆字节限制。您可以自行分配。 您可以查看此链接
但是,如果您想进行大量数据操作并对数据进行更多控制时,建议使用 SQLite。
我的意见:我认为 Firebase 离线持久性对您来说就足够了,所以就去做吧。
It depends on what you want or need.
If you want to use the offline persistance only for storing in case internet is not there at all. Firebase supports that out of the box. But you need to keep in mind to do you calls carefully. Because on a slow internet connection, if you tell the Firebase access to wait for the online behavior. It will not be using the local first and you might not be able to show the data. Check the question here
Also if you want to use the offline persistance from Firebase, be mindful that the data size has a default of 40 megabytes of limit. You might assign that by your self. You can check this link
BUT, if you want to have heavy data manipulations and have more control over your data SQLite is more suggested.
My opionion: I think Firebase Offline persistance would be enough for you, so go for it.