The name speaks for itself—the FutureBuilder
widget will help us build our UI widgets in the future. Why might someone want to build a UI widget later in time instead of instantly? Let’s understand this by looking at a scenario.
Suppose we want to build a news feed application. When the consumer opens our app, the app needs to fetch relevant news from the server and then show it to the UI. But fetching anything from the server will take some time, for obvious reasons, and that’s why we have to wait momentarily to render the UI.
Let’s see the functioning of the widget with an example.
Example
Let’s look at the code below:
Get hands-on with 1400+ tech skills courses.