I'm uploading an image using the bloc pattern. I have a bloc listener that listens for for the state UploadSuccess
. I'd like to call two methods in the listener, One to pop the route and another to show a snackbar:
if (state is UpLoadSuccess) {
RioHelpers.showSuccessFlushBar(context, "Document Uploaded!");
Navigator.pop(context);
}
Calling one of the methods works correctly. I can either pop the route or show the snackbar but not both. When both the methods are present nothing happens. How can I call both the methods?
here is the flushbar:
static void showSuccessFlushBar(BuildContext context, String title) {
Flushbar(
duration: Duration(seconds: 3),
icon: Icon(
Icons.check,
color: Colors.white,
),
backgroundColor: RioColours.snackBarSuccess,
message: title,
flushbarStyle: FlushbarStyle.FLOATING,
margin: EdgeInsets.all(8),
borderRadius: 8,
)..show(context);
}