replace method

Future<void> replace(
  1. String path
)

Navigates to path by replacing the current browser history entry in place.

Evaluates route guards similarly to navigate, but replaces the current history record via window.history.replaceState instead of pushing a new history item. Useful for authentication redirects or updating URL query parameters without polluting the browser back-button history.

await controller.replace('/search?q=shoes&page=2');

Implementation

Future<void> replace(String path) async {
  await _handleNavigation(path, replaceState: true);
}