navigateNamed method

Future<void> navigateNamed(
  1. String path, {
  2. bool includePrefixMatches = false,
  3. OnNavigationFailure? onFailure,
})

Pops until given path, if it already exists in stack otherwise adds it to the stack

if includePrefixMatches is true prefixed-matches will be added to to target destination see RouteMatcher.matchUri

if onFailure callback is provided, navigation errors will be passed to it otherwise they'll be thrown

Implementation

Future<void> navigateNamed(
  String path, {
  bool includePrefixMatches = false,
  OnNavigationFailure? onFailure,
}) {
  final scope = _findPathScopeOrReportFailure<RoutingController>(
    path,
    includePrefixMatches: includePrefixMatches,
    onFailure: onFailure,
  );
  if (scope != null) {
    return scope.router._navigateAll(
      scope.matches,
    );
  }
  return SynchronousFuture(null);
}