I'm creating an app which recovers and shows a html text which is stored online on a mysql host. If the snapshot doesn't have any data it should retry the query and rebuild the view until it gets the data.
This is how I'm creating my widget with the data from the database:
FutureBuilder(
future: crud_database.getDatos(url),
builder: (context, snapshot){
if(snapshot.hasError) print(snapshot.error);
if( snapshot.hasData){
return WebView(
initialUrl: UriData.fromString(snapshot.data[0]["webhtml"], mimeType: "text/html").toString() ,
onWebViewCreated: (WebViewController webViewController){
_controller.complete(webViewController);
},
);
}else{
return Center(
child: CircularProgressIndicator(),
);
}
},
)