in nav2-usability/scenario_code/lib/deeplink-pathparam/router.dart [78:97]
Future<BookRoutePath> parseRouteInformation(
RouteInformation routeInformation) async {
final uri = Uri.parse(routeInformation.location!);
// Handle '/'
if (uri.pathSegments.isEmpty) {
return BookRoutePath.home();
}
// Handle '/book/:id'
if (uri.pathSegments.length == 2) {
if (uri.pathSegments[0] != 'book') return BookRoutePath.home();
final remaining = uri.pathSegments[1];
final id = int.tryParse(remaining);
if (id == null) return BookRoutePath.home();
return BookRoutePath.details(id);
}
// Handle unknown routes
return BookRoutePath.home();
}