canPop method
Returns whether the navigation stack can be popped.
Returns true if there are pages in the navigation history that can be popped (i.e., more than one page in the stack).
Implementation
bool canPop() {
return _history.isNotEmpty && _history.length > 1;
}