i want to rebuild my FutureBuilder after if's
builder leads to snapshot.hasError
I tried using Statefullbuilder to rebuild my FutureBuilder by making and changing random bool, is it a way to resolve problem? I really can't find out until problem comes out
bool boolin = false;
StatefulBuilder(
builder: (context, setState) => FutureBuilder(
initialData: '',
future: func,
builder: ((context, snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.connectionState ==
ConnectionState.done) {
if (snapshot.hasError) {
setState(() {
!booling;
});
setState.call;
return const Text('data1');
} else {
return const Text('data2');
}
} else {
return Text(snapshot.connectionState.toString());
}
})))