pushNewBuildContext method

void pushNewBuildContext({
  1. required BuildContext context,
  2. required String routePath,
  3. required Object? state,
})

Implementation

void pushNewBuildContext({required BuildContext context, required String routePath, required Object? state}) {
  _buildContextStack.add(HybridRoutePageContext(routePath, context, state));

  // Initialize performance metrics for this route if not already present
  if (!_routeMetrics.containsKey(routePath)) {
    _routeMetrics[routePath] = RoutePerformanceMetrics(routePath);
    // Initialize the navigation start time for the new route
    _routeMetrics[routePath]!.navigationStartTime = DateTime.now();
    // Capture the initial evaluated state when route is pushed
    _routeMetrics[routePath]!.initialEvaluatedState = evaluated;
  }
}