setNewRoutePath method

  1. @override
Future<void> setNewRoutePath(
  1. RouteData configuration
)
override

Called by the Router when the Router.routeInformationProvider reports that a new route has been pushed to the application by the operating system.

Consider using a SynchronousFuture if the result can be computed synchronously, so that the Router does not need to wait for the next microtask to schedule a build.

Implementation

@override
Future<void> setNewRoutePath(RouteData configuration) async {
  if(!await _validate(configuration.routeString)) {
    return;
  }
  // TODO: allow parent pages to be included
  // Currently, this clears the route stack, which means
  // Any time a new deep link is handled the set of pages is cleared.
  _routeStack
    ..clear()
    ..add(configuration.routeString);
  notifyListeners();
}