Future parseRouteInformation()

in nav2-usability/scenario_code/lib/nested-routing/router.dart [57:74]


  Future<AppRoutePath> parseRouteInformation(
      RouteInformation routeInformation) async {
    var uri = Uri.parse(routeInformation.location!);
    if (uri.pathSegments.isEmpty) {
      return NewBooksRoutePath();
    }
    if (uri.pathSegments.length == 1) {
      if (uri.pathSegments[0] == 'books') return NewBooksRoutePath();
      if (uri.pathSegments[0] == 'settings') return SettingsRoutePath();
    }

    if (uri.pathSegments.length == 2) {
      if (uri.pathSegments[1] == 'new') return NewBooksRoutePath();
      if (uri.pathSegments[1] == 'all') return AllBooksRoutePath();
    }

    return NewBooksRoutePath();
  }