replaceQuery method

Future<void> replaceQuery(
  1. Map<String, dynamic> query
)

Replaces the query string on the current pathname in place without pushing a new history entry.

Useful for filters, search terms, or sorting options that should not create separate browser back-button entries. Retains the current pathname and any existing hash fragment.

// Updates URL in place to '/current-path?sort=desc'
await controller.replaceQuery({'sort': 'desc'});

Implementation

Future<void> replaceQuery(Map<String, dynamic> query) async {
  await setQuery(query, replace: true);
}