popPage method

void popPage(
  1. dynamic result
)

Pop the last page from the stack and return the result if exists

Implementation

void popPage(dynamic result) {
  //todo logging
  developer.log("pages: ${pages.toString()}", name: 'AppNavigationManager::popPage');
  int length = appRouteDataList.length;
  if (length > 0) {
      if (appRouteDataList[length - 1].pages.length > 1) {
        appRouteDataList[length - 1].pages.removeLast();
      } else {
        if (appRouteDataList[length - 1].completer != null) {
          appRouteDataList[length - 1].completer!.complete(result);
        }
        appRouteDataList.removeLast();
      }
  }

  // Add initial path if there are no pages
  if (appRouteDataList.isEmpty) {
    addInitialPath();
  }

  notifyListeners();
}