dart

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):

Tags