FutureBuilder

FutureBuilder is a widget that builds its content according to the state of a Future: waiting, completed with data, or in error. It avoids handling these states by hand with setState and lets you display a loading indicator or an error message.

Example

FutureBuilder<List<Item>>(
  future: charger(),
  builder: (c, snap) => snap.hasData ? Liste(snap.data!) : const CircularProgressIndicator(),
)

Related concepts

The whole glossary