setState not working from inside AlertDialog
Solution 1:
The main state class also have setState
and while you are using StatefulBuilder
it also has setState
, being scope priority setState
is coming from StatefulBuilder
. You can rename it and use
child: StatefulBuilder(
builder: (context, setStateSB) {
....
setState((){ /// for state class IU update
tasbeehChantCanAdd = "state changed";
});
setStateSB((){ // update Ui inside dialog
tasbeehChantCanAdd = "state changed";
});