pop method

void pop()

Pops the current page from the navigation stack.

Removes the last page from the navigation history and updates the selected index to the previous page. Does nothing if the history is empty.

Implementation

void pop() {
  if (_history.length <= 1) {
    return;
  }
  setState(() {
    _navRailKey.currentState?.setSecondaryActions([]);
    _history.removeLast();
    _selectedIndex = _history.length - 1;
    if (_dynamicHistory.length > 1) {
      _dynamicHistory.removeLast();
    } else if (_dynamicHistory.length == 1) {
      _dynamicHistory.clear();
      _fullscreen = false;
    }
  });
}