HTTP requests

An HTTP request lets the app exchange data with a remote API, for example with the http package: get, post, etc. The call is asynchronous and returns a response containing a status code and a body. You must check the status and handle network errors.

Example

final r = await http.get(Uri.parse('https://api.example.com/items'));
if (r.statusCode == 200) { /* ... */ }

Related concepts

The whole glossary