stream-builder

Listview builder scrolling in Flutter not smooth when combining futurebuilder and streambuilder

早过忘川 提交于 2021-01-29 18:33:52
问题 I have a comment page for each post in my app that I use streambuilder to fetch the comments from Firebase database. For each comment, I am displaying user's image and their comment. To get the user's image, I need to use a futurebuilder to find the user in the userData document and then grab the image url and display it (users can change their image profile, name, etc. at any time and I have to grab the updated one from the userData document every time I want to display their name or image

Flutter: Unable to read data from firebase. The method '[]' was called on null error

折月煮酒 提交于 2021-01-29 12:11:01
问题 I am trying to read the data from firebase after scanning a barcode. This is how it should appear, but instead of barcode, it should display name and price from the database (https://m.imgur.com/gallery/lEFJZ0Q) Code: class ListTileModel { String barcode; ListTileModel(this.barcode); } the below code is inside the stateful widget List<ListTileModel> _items = []; String barcode = ""; void _add() { _items.add(ListTileModel(barcode)); setState(() {}); } @override void initState(){ super

Condition does not work when using a streamBuilder in Flutter

别来无恙 提交于 2020-12-10 07:54:33
问题 I'm trying to implement a screen that displays data from Firebase but I want the streambuilder to check if the database is empty, if it's empty I want it to show a text saying "no data" but if it's not, I want it to show the data from firebase. This is the code I have but it does not work as expected, it just shows me a blank screen when there is no data(it works fine when I have data in the database, I just don't want the user to see a blank screen when there is no data). Can you advise what

Condition does not work when using a streamBuilder in Flutter

穿精又带淫゛_ 提交于 2020-12-10 07:54:28
问题 I'm trying to implement a screen that displays data from Firebase but I want the streambuilder to check if the database is empty, if it's empty I want it to show a text saying "no data" but if it's not, I want it to show the data from firebase. This is the code I have but it does not work as expected, it just shows me a blank screen when there is no data(it works fine when I have data in the database, I just don't want the user to see a blank screen when there is no data). Can you advise what