I am working on a Flutter project where I am displaying a calendar of items on the screen. The screen shows a week’s worth of entries and each day was represented by a stateful widget that queried the application server for entries belonging to its day.
Flutter: Another option for using FutureBuilder with multiple futures
Typically, FutureBuilder is used to wait for a single future and there is a simple way of using FutureBuilder to wait for multiple futures, but what if you want a more complicated, yet possibly more readable way, to use FutureBuilder to wait for multiple futures? I have found that way!
Suppose the data you are waiting for are 2 lists of String. In my example, the list of strings are month names and weekday names. Here are the two functions that return these two lists in the future (by waiting 10 and 13 seconds):