deepClean property

void get deepClean

Removes redundant screens when the screenViewHistory gets more than 7 active screens. acts as a flush for the screenViewHistory and the optionsHistory

Implementation

void get deepClean {
  if (screenViewHistory.length >= 7) {
    int last = screenViewHistory.length;
    List<Widget> screenHistoryCache = [];
    List<BaseContainerOptions> optionsHistoryCache = [];
    screenHistoryCache.add(screenViewHistory[last - 2]);
    screenHistoryCache.add(screenViewHistory.last);
    optionsHistoryCache.add(optionsHistory[last - 2]);
    optionsHistoryCache.add(optionsHistory.last);

    screenViewHistory = screenHistoryCache;
    optionsHistory = optionsHistoryCache;
  }
}