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.isSnackbar) {
  //   // Get.log("OPEN SNACKBAR ${newRoute.name}");
  //   Get.log("OPEN SNACKBAR");
  // } else

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

  RouterReportManager.reportCurrentRoute(route);
  _routeSend?.update((value) {
    // Only PageRoute is allowed to change current 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);
  }
}