close<T extends Object> method
void
close<T extends Object>({})
Closes specific overlays based on the provided flags.
closeAll determines if all overlays should be closed.
closeSnackbar, closeDialog, closeBottomSheet control which specific overlays to close.
id is for nested navigation.
result is the result passed back when closing the overlays.
Implementation
void close<T extends Object>({
bool closeAll = true,
bool closeSnackbar = true,
bool closeDialog = true,
bool closeBottomSheet = true,
String? id,
T? result,
}) {
void handleClose(bool closeCondition, Function closeAllFunction,
Function closeSingleFunction,
[bool? isOpenCondition]) {
if (closeCondition) {
if (closeAll) {
closeAllFunction();
} else if (isOpenCondition == true) {
closeSingleFunction();
}
}
}
handleClose(closeSnackbar, closeAllSnackbars, closeCurrentSnackbar);
handleClose(closeDialog, closeAllDialogs, closeOverlay, isDialogOpen);
handleClose(closeBottomSheet, closeAllBottomSheets, closeOverlay,
isBottomSheetOpen);
}