I´m trying something like that. Load the service in Future Builder, set Text Field values and then write the component.
final data = FutureBuilder(
future: DatameterService.getMapData(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
setState(() {
calleController.text = snapshot.data.calle;
paisController.text = snapshot.data.pais;
provinciaController.text = snapshot.data.provincia;
poblacionController.text = snapshot.data.poblacion;
postalController.text = snapshot.data.postal;
});
return form;
} else {
return indicator;
}
But return
setState() or markNeedsBuild() called during build.
So the question is: How can fill TextField inputs values using FutureBuilder?