canPop method
Whether the navigator can pop the current route.
Returns true if there are at least two routes on the stack and
the current route's Route.canPop returns true.
Implementation
bool canPop() {
if (_routes.length <= 1) return false;
final currentRoute = _routes.last;
if (!currentRoute.canPop()) return false;
// Check PopBehavior.canPop if provided.
final popCanPop = widget.popBehavior.canPop;
if (popCanPop != null && !popCanPop(currentRoute)) return false;
return true;
}