safaehPop<T> function
Pops the navigator that opened the current Safaeh route.
PopScope.canPop false makes Navigator.canPop false even when a dialog is on the stack. Chrome dismiss still pops that route.
Implementation
void safaehPop<T>(BuildContext context, [T? result]) {
final navigator = Navigator.of(
context,
rootNavigator: SafaehNavigatorScope.of(context),
);
if (navigator.canPop()) {
navigator.pop(result);
return;
}
final route = ModalRoute.of(context);
if (route != null && route.isCurrent && !route.isFirst) {
navigator.pop(result);
}
}