closeHistory method

void closeHistory(
  1. MenuHistory history
)

Implementation

void closeHistory(MenuHistory history) {
  int index = _history.indexOf(history);
  if (_history.length == 1) {
    return;
  }
  if (state.activeMenu != history.menuPath) {
    _history.remove(history);
    notifyListeners();
    return;
  }
  MenuHistory nextActiveHistory;
  if (index == _history.length - 1) {
    ///
    nextActiveHistory = _history[_history.length - 2];
  } else {
    nextActiveHistory = _history[index + 1];
  }
  _history.remove(history);
  selectHistory(nextActiveHistory.menuPath);
}