我正在使用下面的代码。我单击某个按钮,如果我的 OTP 匹配下面的方法被调用。在那种方法中,我正在调用 bloc。我正在使用的小部件是 Statefulwidget。
void matchOtp() {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(ALERT_TITLE),
content: Text(OtpMatchSuccess),
actions: <Widget>[
IconButton(
icon: Icon(Icons.check),
onPressed: () {
if(OtpMatchSuccess == ALERT_OTP_MATCHED){
bloc.calledmethodinBloc(); // this method get called properly
StreamBuilder(
stream: bloc.usertype,
builder: (context, AsyncSnapshot<
ResponseModel> snapshot) {
print("INSIDE"); // My code does not go here.
return Center(child: CircularProgressIndicator());
}
);
print("OUTSIDE");// My code moves outside the streambuilder. Is there any reason for that?
}else{
Navigator.of(context, rootNavigator: true).pop('dialog');
}
})
],
);
});
}