getx
getx copied to clipboard
How to close all overlays?
To close all overlays and page we can use:
Get.back(closeOverlays: true);
But in order to close only the overlays (bottom sheet, dialog and snackbar), we can´t use any functions.
I have noticed if I have snackbar and dialog I can´t close both, even using something like this:
Future<void> closeAllOverlays() async {
if (Get.isDialogOpen ?? false) {
Get.back();
}
if (Get.isBottomSheetOpen ?? false) {
Get.back();
}
if (Get.isSnackbarOpen) {
Get.back();
}
}
Is there any GET function to close all overlays? I have found closeAllSnackbars() and closeCurrentSnackbar(), but this doesn´t achive closing all overlays.
You could now use Get.until((_) => !Get.isOverlaysOpen)
not working