setInitialRoutePath method

  1. @override
Future<void> setInitialRoutePath(
  1. String configuration
)
override

Called by the Router at startup with the structure that the RouteInformationParser obtained from parsing the initial route.

This should configure the RouterDelegate so that when build is invoked, it will create a widget tree that matches the initial route.

By default, this method forwards the configuration to setNewRoutePath.

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.

See also:

Implementation

@override
Future<void> setInitialRoutePath(String configuration) async {
  await _controllerCompleter.future;
  if (configuration != _slash) {
    QR.log('incoming init path $configuration', isDebug: true);
    if (alwaysAddInitPath) {
      QR.log(
          'adding init path $initPath because QRouterDelegate.alwaysAddInitPath is true',
          isDebug: true);
      await QR.to(initPath ?? _slash);
    }
    await QR.to(configuration);
    return;
  }
  await _controller.push(initPath ?? _slash);
}