close<T extends Object> method

void close<T extends Object>({
  1. bool closeAll = true,
  2. bool closeSnackbar = true,
  3. bool closeDialog = true,
  4. bool closeBottomSheet = true,
  5. String? id,
  6. T? result,
})

Navigation.popUntil() (with predicate) shortcut .

Close as many routes as defined by times

id is for when you are using nested navigation, as explained in documentation

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);
}