In this recipe, getPosition is the Future we will pass to the FutureBuilder. In this case, initState is not required at all: FutureBuilder takes care of updating the user interface whenever there's a change in the data and state information.
Note that there are two properties we are setting for FutureBuilder: the future, which in this example is our getPosition() method, and the builder.
The builder takes the current context and an AsyncSnapshot, containing all the Future data and state information: the builder must return a widget.
The connectionState property of the AsyncSnapshot object makes you check the state of the Future. In particular, you have the following:
- waiting means the Future was called but has not yet completed its execution.
- done means that the execution completed.