I have a global stream and it's listener. Simply, if something was added to the stream, the app will call showModalBottomSheet
function. The problem is, sometimes in the process I have to add two value to the stream, but I only want one modal bottom sheet to be shown.
I was looking for how to close current shown bottom sheet in Flutter as we do with the Snackbar by invoking ScaffoldMessenger.of(context).hideCurrentSnackbar()
.
I've looked here on how to close a bottom sheet programmatically using PersistentBottomSheetController but I think it doesn't suit in my problem since I use the showModalBottomSheet which is not a part of Scaffold.
Is there any way I can achieve this?