lib/config/router/app_router.dart and exported as the appRouter instance.
Router configuration
MovieScreen route is nested under HomeScreen, making its full resolved path /movie/:id.
Routes
The movieId path parameter
The :id segment in /movie/:id is a named path parameter. GoRouter extracts it from state.pathParameters:
movieId string is passed directly to MovieScreen as a required constructor parameter:
If the
:id parameter is missing or cannot be parsed, the router falls back to the string 'no-id'.Navigating to a movie detail
Navigation from a list item to the detail screen is triggered by aGestureDetector tap inside MovieHorizontalListview. It uses GoRouter’s context.push() with the movie’s ID interpolated into the path:
1
User taps a movie poster
The
GestureDetector in _Slide (inside MovieHorizontalListview) fires its onTap callback.2
GoRouter pushes the detail route
context.push('/movie/${movie.id}') adds /movie/:id on top of the current navigation stack, keeping HomeScreen in the back stack.3
MovieScreen receives the ID
GoRouter extracts the
:id segment and passes it to MovieScreen as movieId.Route name constants
Both screens define a staticname constant that is referenced in the router config. Using the constant instead of a raw string prevents typos and makes renaming safer: