I want to navigate into new screen if snapshot.hasData
but i dont know how to do that
This is my code :
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
FutureBuilder<String>(
future: getPosts(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text(
'There was an error :(',
);
} else if (snapshot.hasData) {
return Text('data');
} else {
return AlertDialog(
title: Text('Title'),
content: SingleChildScrollView(
child: Text('data'),
),
);
}
},
),
],
);
}
If someone can give me a better way to solve this question it would be great :)
Aucun commentaire:
Enregistrer un commentaire