closePopup method Null safety

bool closePopup(
  1. {bool isCancel = true}
)
override

Implementation

bool closePopup({bool isCancel = true}) {
  if (isCancel)
    Navigator.of(context, rootNavigator: true).pop();
  else
    Navigator.of(context, rootNavigator: true).popUntil((route) => !route.settings.name!.startsWith(PopupScreen.routeName));
  if (widget.onClose != null) widget.onClose!();
  return true;
}