didPop method

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

void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) async {
  final context = previousRoute?.navigator?.context;

  if (previousRoute == null ||
      previousRoute is! MaterialRouteTransitionMixin) {
    return;
  }
  await Future.delayed(previousRoute.transitionDuration);

  final screenName = previousRoute.settings.name;
  if (screenName == null) {
    return;
  }

  RenderRepaintBoundary? renderRepaintBoundary =
      context?.findAncestorRenderObjectOfType<RenderRepaintBoundary>();

  VisualTracking.handle(
    action: "didPop",
    targetText: "",
    actionId: screenName,
    renderRepaintBoundary: renderRepaintBoundary,
  );
}