setNewRoutePath method

  1. @override
Future<Uri> setNewRoutePath(
  1. Uri configuration
)
override

handle routes pushed by operating system, typically processing initial route

Implementation

@override
Future<Uri> setNewRoutePath(Uri configuration) {
  /// default to '/' ; configure this through [StackRouteInformationProvider.initialRoute]
  final index = _descriptors.indexWhere((e) => e.name == configuration.path);

  _log('Set New Route By Path :${configuration.path}');

  /// [TODO: support NOT-FOUND on platform web]
  if (index == -1) {
    if (_routes.isEmpty) {
      /// application start up , first route pushed. no route name matched
      _routes.add(_buildRoute(_descriptors.first));
      _log('Set Initial Route, No Page Descriptor Matched :${configuration.path}, Use First Route');
    } else {
      _log('No Page Descriptor Matched :${configuration.path}, Navigation Action Ignored');
    }
  } else {
    _routes.add(_buildRoute(_descriptors[index]));
  }
  return SynchronousFuture(configuration);
}