📱 Flutter Intermediate

What does FutureBuilder do in Flutter?

Why Interviewers Ask This

This tests whether you can apply Flutter knowledge to real-world scenarios. Interviewers are looking for clarity of thought and evidence that you've encountered this in production code.

Answer

FutureBuilder builds its UI based on the current state of an asynchronous Future. It rebuilds whenever the Future changes state. The builder receives an AsyncSnapshot with a connectionState (none, waiting, done) and the resulting data or error. You use this to show a loading spinner while data is being fetched, an error message if it fails, and the actual UI when the data is available. Important: pass a pre-created Future or the FutureBuilder will restart the future on every rebuild.

Pro Tip

Before answering, structure your response: one-line definition → real-world analogy → concrete example from a project. This makes even complex Flutter answers easy to follow.