canPopUntilPopUp method

bool canPopUntilPopUp({
  1. required String popUpName,
})

Implementation

bool canPopUntilPopUp({required String popUpName}) {
  if (openedDialogOrBottomSheetList.isEmpty) return false;

  //use sublist to skip checking the last one. it pops anyway even if it is equal to the input
  bool nameIsInDialogsOrBottomSheets = openedDialogOrBottomSheetList
      .sublist(0, openedDialogOrBottomSheetList.length - 1)
      .any((element) => _getPopUpNameFromRegisteredString(popUpNameAndKey: element) == popUpName);

  return nameIsInDialogsOrBottomSheets;
}