setNewRoutePath method

  1. @override
Future<void> setNewRoutePath(
  1. StandardRouteData 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(StandardRouteData configuration) {
  if (!_initialRouteProcessed) {
    _initialRouteData = configuration;

    if (!_startupSequenceProcessed) {
      final tEnv = getApp().environment;
      final tAutoProcessInitialRoute = switch (tEnv) {
        StandardAppEnvironment() => tEnv.autoProcessInitialRoute,
        _ => true
      };
      if (tAutoProcessInitialRoute) {
        processInitialRoute();
      }
    }

    return SynchronousFuture(null);
  }

  routeWithConfiguration(configuration);

  return SynchronousFuture(null);
}