didPop method

  1. @override
void didPop(
  1. Route route,
  2. Route? previousRoute
)
override

The Navigator popped route.

The route immediately below that one, and thus the newly active route, is previousRoute.

Implementation

@override
void didPop(Route route, Route? previousRoute) {
  super.didPop(route, previousRoute);
  final _RouteData currentRoute = _RouteData.ofRoute(route);
  final _RouteData newRoute = _RouteData.ofRoute(previousRoute);

  if (currentRoute.isBottomSheet || currentRoute.isDialog) {
    Get.log("CLOSE ${currentRoute.name}");
  } else if (currentRoute.isGetPageRoute) {
    Get.log("CLOSE TO ROUTE ${currentRoute.name}");
  }

  if (previousRoute != null) {
    RouterReportManager.instance.reportCurrentRoute(previousRoute);
  }

  _routeSend?.update((Routing value) {
    if (previousRoute is PageRoute) {
      value.current = _extractRouteName(previousRoute) ?? "";
      value.previous = newRoute.name ?? "";
    } else if (value.previous.isNotEmpty) {
      value.current = value.previous;
    }

    value.args = previousRoute?.settings.arguments;
    value.route = previousRoute;
    value.isBack = true;
    value.removed = "";
    value.isBottomSheet = newRoute.isBottomSheet;
    value.isDialog = newRoute.isDialog;
  });

  routing?.call(_routeSend);
}