to abstract method

void to(
  1. String path, {
  2. Map<String, String> queryParameters = const {},
  3. String? hash,
  4. Map<String, String> historyState = const {},
  5. bool isReplacement = false,
})

The main method to navigate to a new path

Note that the path should be a valid url. If you fear part of you url might need encoding, use toSegments instead

path can be of one of two forms:

  • stating with '/', in which case we just navigate to the given path
  • not starting with '/', in which case we append the given path to the current one

queryParameters to add query parameters (you can also add them manually)

historyState is used an the web to restore browser history entry specific state (like scroll amount)

isReplacement determines whether to overwrite the current history entry or create a new one. The is mainly useful when using back, forward or vRouteInformationAt, or on the web to control the browser history entries

Also see:

  • toSegments if you need your path segments to be encoded
  • toNamed if you want to navigate by name
  • toExternal if you want to navigate to an external url

Implementation

void to(
  String path, {
  Map<String, String> queryParameters = const {},
  String? hash,
  Map<String, String> historyState = const {},
  bool isReplacement = false,
});