handlePopPage method

bool handlePopPage(
  1. Route route,
  2. dynamic result
)

Implementation

bool handlePopPage(Route<dynamic> route, dynamic result) {
  if (!route.didPop(result)) {
    return false;
  }
  pageTrack.removeLast();
  String currentRoute = pageTrackIndexMapRoute[pageTrack.length - 1]!;
  var currentPage = appRoutePath.getRoutePageByRoute(currentRoute);
  // 处理返回hook的返回页面是否与当前页面不同,不同则进行替换
  if (before != null) {
    before!(currentPage).then((newPage) {
      if (newPage.location == currentPage.location) {
        appRoutePath.currentPage = currentPage;
      } else {
        appRoutePath.currentPage = newPage;
        replaceCurrentPageInfo = newPage;
      }
      notifyListeners();
    });
  } else {
    appRoutePath.currentPage = currentPage;
    notifyListeners();
  }

  return true;
}