Future, async and await

A Future represents a value available later, for example the result of a network request. The async keyword marks an asynchronous function and await waits for the result without blocking the interface. Errors are handled with try/catch as in synchronous code.

Example

Future<String> charger() async {
  final r = await http.get(url);
  return r.body;
}

Related concepts

The whole glossary