previewRoute method

NyRouterRoute previewRoute()

Set this route as a preview route. This will override any existing initialRoute and authenticatedRoute settings on all other routes, making this route the initial route. Useful for quickly previewing a specific route during development.

Implementation

NyRouterRoute previewRoute() {
  // Clear preview and initial flags on all other routes
  Map<String, NyRouterRoute> routes = NyNavigator.instance.router
      .getRegisteredRoutes();
  for (var route in routes.values) {
    route._previewRoute = false;
    route._initialRoute = false;
  }

  // Set this route as the preview route
  _previewRoute = true;
  _initialRoute = true; // Keep for backwards compatibility
  NyNavigator.instance.router.updateRoute(this);
  return this;
}