didPush method

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

The Navigator pushed route.

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

Implementation

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

  if (newRoute.isBottomSheet || newRoute.isDialog) {
    Get.log("OPEN ${newRoute.name}");
  } else if (newRoute.isGetPageRoute) {
    Get.log("GOING TO ROUTE ${newRoute.name}");
  }

  RouterReportManager.instance.reportCurrentRoute(route);

  _routeSend?.update((Routing value) {
    if (route is PageRoute) {
      value.current = newRoute.name ?? "";
    }

    final String? previousRouteName = _extractRouteName(previousRoute);
    if (previousRouteName != null) {
      value.previous = previousRouteName;
    }

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

  routing?.call(_routeSend);
}