我如何从firebase中检索数据,而无需刷新
我在Firebase实时数据库中具有布尔值,我需要一个更新的值,而无需屏幕刷新。 我希望它可以在颤抖上进行更新
I have Boolean value in Firebase Realtime database i want a updated value without a screen Refresh in flutter.
i want it to be updated streamline on flutter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
处理您的问题的一种简单方法是使用“ Cloud_firestore”软件包。
我将在下面制作UA示例代码。
注意:使用Firestore之前,您必须首先确保您已经初始化了Flutterfire!请点击此链接: https://firebase.flutter.flutter.docs.docs.docs/docs/overview/overveive/view/view/view/#初始化flutterfire
An easy way to handle your issue is to use "cloud_firestore" package.
i'll make u a sample code below..
Note : Before using Firestore, you must first have ensured you have initialized FlutterFire! follow this link: https://firebase.flutter.dev/docs/overview/#initializing-flutterfire
如果您在firebase实时数据库中有数据,则可以通过其
onvalue
stream 。您可以使用streamBuilder
:我建议观看此出色的Code-Along视频: firebase实时数据库和扑朔迷离-Firecasts
If you have data in the Firebase Realtime Database, you can listen to update to that data through its
onValue
stream. You can use this stream in your widget tree by using aStreamBuilder
:I recommend watching this great code-along video: The Firebase Realtime Database and Flutter - Firecasts