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 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((value) {
    if (route is PageRoute) {
      value.current = newRoute.name ?? '';
    }
    final 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 ? true : value.isBottomSheet ?? false;
    value.isDialog = newRoute.isDialog ? true : value.isDialog ?? false;
  });

  if (routing != null) {
    routing!(_routeSend);
  }
}