flutter-futurebuilder

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

What is a Future and how do I use it?

纵然是瞬间 提交于 2020-08-13 05:29:25
问题 I get the following error: A value of type 'Future<int>' can't be assigned to a variable of type 'int' It might be another type instead of int , but basically the pattern is A value of type 'Future<T>' can't be assigned to a variable of type 'T' So... What exactly is a Future ? How do I get the actual value I want to get? What widget do I use to display my value when all I have is a Future<T> ? 回答1: In case you are familiar with Task<T> or Promise<T> and the async / await pattern, then you