> For the complete documentation index, see [llms.txt](https://meulencv.gitbook.io/flutter-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://meulencv.gitbook.io/flutter-documentation/widgets/future-builder.md).

# Future builder

A future builder is a widget that can run futures

First, you need to create a future:

```dart
Future<String> nameOfFuture (String url) async {
//code
  return //code;
}
```

And later create the future builder connected to the future created previously:

```dart
FutureBuilder(
          future: nameOfFuture(),
          builder: (BuildContext context, AsyncSnapshot snapshot) {
            if (snapshot.connectionState == ConnectionState.waiting) {
               return // code of what to do when is waiting for response
             } else {
               return // code of what to do when the response is here!
               // The response is returned in the "snapshot" variable
               );
             }
           },
         ),
```
