routeInformationUpdated static method

Future<void> routeInformationUpdated(
  1. {@Deprecated('Pass Uri.parse(location) to uri parameter instead. ' 'This feature was deprecated after v3.8.0-3.0.pre.') String? location,
  2. Uri? uri,
  3. Object? state,
  4. bool replace = false}

Notifies the platform for a route information change.

On web, this method behaves differently based on the single-entry or multiple-entries history mode. Use the selectSingleEntryHistory and selectMultiEntryHistory to toggle between modes.

For single-entry mode, this method replaces the current URL and state in the current history entry. The flag replace is ignored.

For multiple-entries mode, this method creates a new history entry on top of the current entry if the replace is false, thus the user will be on a new history entry as if the user has visited a new page, and the browser back button brings the user back to the previous entry. If replace is true, this method only updates the URL and the state in the current history entry without pushing a new one.

This method is ignored on other platforms.

The replace flag defaults to false.


static Future<void> routeInformationUpdated({
    'Pass Uri.parse(location) to uri parameter instead. '
    'This feature was deprecated after v3.8.0-3.0.pre.'
  String? location,
  Uri? uri,
  Object? state,
  bool replace = false,
}) {
  assert((location != null) != (uri != null), 'One of uri or location must be provided, but not both.');
  uri ??= Uri.parse(location!);
  return SystemChannels.navigation.invokeMethod<void>(
    <String, dynamic>{
      'uri': uri.toString(),
      'state': state,
      'replace': replace,