Repository: flutter
Issue: [go_router_builder] Nested TypedStatefulShellRoute is not generating parameters
Labels: package,has reproducible steps,p: go_router_builder,team-go_router,found in release: 3.27,found in release: 3.28

### Steps to reproduce

1. Using go_router_builder: ^2.7.3
2. Run build_runner to generate routes
3. Start compiling


### Expected results

In the generated file it should have generated this:

```dart
extension $HomeStatefulShellRouteCExtension
    on HomeStatefulShellRouteC {
  static HomeStatefulShellRouteC _fromState(GoRouterState state) =>
      HomeStatefulShellRouteC(id: state.pathParameters['id']!);
}
```

### Actual results

```dart
extension $HomeStatefulShellRouteCExtension
    on HomeStatefulShellRouteC {
  static HomeStatefulShellRouteC _fromState(GoRouterState state) =>
      HomeStatefulShellRouteC();
}
```

### Code sample

<details open><summary>Code sample</summary>

```dart
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// ignore_for_file: public_member_api_docs, unreachable_from_main

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

part 'main.g.dart';

void main() => runApp(App());

class App extends StatelessWidget {
  App({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp.router(
        routerConfig: _router,
      );

  final GoRouter _router = GoRouter(
    routes: $appRoutes,
    initialLocation: '/home/a',
  );
}

@TypedShellRoute<HomeShellRoute>(
  routes: [
    TypedGoRoute<HomeRouteA>(path: '/home/a'),
    TypedGoRoute<HomeRouteB>(path: '/home/b'),
    TypedGoRoute<HomeRouteC>(
      path: '/home/:id',
      routes: [
        TypedStatefulShellRoute<HomeStatefulShellRouteC>(
          branches: <TypedStatefulShellBranch<StatefulShellBranchData>>[
            TypedStatefulShellBranch<BranchAData>(
              routes: <TypedRoute<RouteData>>[
                TypedGoRoute<DetailsARouteData>(path: 'detailsA'),
              ],
            ),
            TypedStatefulShellBranch<BranchBData>(
              routes: <TypedRoute<RouteData>>[
                TypedGoRoute<DetailsBRouteData>(path: 'detailsB'),
              ],
            ),
          ],
        )
      ],
    )
  ],
)
class HomeShellRoute extends ShellRouteData {
  @override
  Widget builder(BuildContext context, GoRouterState state, Widget navigator) {
    return navigator;
  }
}

class HomeStatefulShellRouteC extends StatefulShellRouteData {
  const HomeStatefulShellRouteC({required this.id});

  final String id;

  @override
  Widget builder(
    BuildContext context,
    GoRouterState state,
    StatefulNavigationShell navigationShell,
  ) {
    return ScaffoldWithNavBar(navigationShell: navigationShell, id: id);
  }
}

class BranchAData extends StatefulShellBranchData {
  const BranchAData();
}

class BranchBData extends StatefulShellBranchData {
  const BranchBData();
}

class HomeRouteA extends GoRouteData {
  @override
  Widget build(BuildContext context, GoRouterState state) {
    return HomeScreen(label: 'Home A');
  }
}

class HomeRouteB extends GoRouteData {
  @override
  Widget build(BuildContext context, GoRouterState state) {
    return HomeScreen(label: 'Home B');
  }
}

class HomeRouteC extends GoRouteData {
  const HomeRouteC({required this.id});

  final String id;

  @override
  Widget build(BuildContext context, GoRouterState state) {
    return SizedBox();
  }
}

class DetailsARouteData extends GoRouteData {
  const DetailsARouteData({required this.id});

  final String id;

  @override
  Widget build(BuildContext context, GoRouterState state) {
    return const DetailsScreen(label: 'A');
  }
}

class DetailsBRouteData extends GoRouteData {
  const DetailsBRouteData({required this.id});

  final String id;

  @override
  Widget build(BuildContext context, GoRouterState state) {
    return const DetailsScreen(label: 'B');
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({required this.label, super.key});

  final String label;

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(title: Text(label)),
        body: Center(
          child: ElevatedButton(
              onPressed: () => context.push('/home/1/detailsA'),
              child: Text('Go to ID page')),
        ),
      );
}

/// Builds the "shell" for the app by building a Scaffold with a
/// BottomNavigationBar, where [child] is placed in the body of the Scaffold.
class ScaffoldWithNavBar extends StatelessWidget {
  /// Constructs an [ScaffoldWithNavBar].
  const ScaffoldWithNavBar({
    required this.navigationShell,
    required this.id,
    Key? key,
  }) : super(key: key ?? const ValueKey<String>('ScaffoldWithNavBar'));

  /// The navigation shell and container for the branch Navigators.
  final StatefulNavigationShell navigationShell;

  /// Id
  final String id;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: navigationShell,
      bottomNavigationBar: BottomNavigationBar(
        // Here, the items of BottomNavigationBar are hard coded. In a real
        // world scenario, the items would most likely be generated from the
        // branches of the shell route, which can be fetched using
        // `navigationShell.route.branches`.
        items: const <BottomNavigationBarItem>[
          BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Section A'),
          BottomNavigationBarItem(icon: Icon(Icons.work), label: 'Section B'),
        ],
        currentIndex: navigationShell.currentIndex,
        onTap: (int index) => _onTap(context, index),
      ),
    );
  }

  /// Navigate to the current location of the branch at the provided index when
  /// tapping an item in the BottomNavigationBar.
  void _onTap(BuildContext context, int index) {
    // When navigating to a new branch, it's recommended to use the goBranch
    // method, as doing so makes sure the last navigation state of the
    // Navigator for the branch is restored.
    navigationShell.goBranch(
      index,
      // A common pattern when using bottom navigation bars is to support
      // navigating to the initial location when tapping the item that is
      // already active. This example demonstrates how to support this behavior,
      // using the initialLocation parameter of goBranch.
      initialLocation: index == navigationShell.currentIndex,
    );
  }
}

/// Custom branch Navigator container that provides animated transitions
/// when switching branches.
class AnimatedBranchContainer extends StatelessWidget {
  /// Creates a AnimatedBranchContainer
  const AnimatedBranchContainer(
      {super.key, required this.currentIndex, required this.children});

  /// The index (in [children]) of the branch Navigator to display.
  final int currentIndex;

  /// The children (branch Navigators) to display in this container.
  final List<Widget> children;

  @override
  Widget build(BuildContext context) {
    return Stack(
        children: children.mapIndexed(
      (int index, Widget navigator) {
        return AnimatedScale(
          scale: index == currentIndex ? 1 : 1.5,
          duration: const Duration(milliseconds: 400),
          child: AnimatedOpacity(
            opacity: index == currentIndex ? 1 : 0,
            duration: const Duration(milliseconds: 400),
            child: _branchNavigatorWrapper(index, navigator),
          ),
        );
      },
    ).toList());
  }

  Widget _branchNavigatorWrapper(int index, Widget navigator) => IgnorePointer(
        ignoring: index != currentIndex,
        child: TickerMode(
          enabled: index == currentIndex,
          child: navigator,
        ),
      );
}

/// The details screen for either the A or B screen.
class DetailsScreen extends StatefulWidget {
  /// Constructs a [DetailsScreen].
  const DetailsScreen({
    required this.label,
    this.param,
    this.extra,
    super.key,
  });

  /// The label to display in the center of the screen.
  final String label;

  /// Optional param
  final String? param;

  /// Optional extra object
  final Object? extra;
  @override
  State<StatefulWidget> createState() => DetailsScreenState();
}

/// The state for DetailsScreen
class DetailsScreenState extends State<DetailsScreen> {
  int _counter = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Details Screen - ${widget.label}'),
      ),
      body: _build(context),
    );
  }

  Widget _build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Text('Details for ${widget.label} - Counter: $_counter',
              style: Theme.of(context).textTheme.titleLarge),
          const Padding(padding: EdgeInsets.all(4)),
          TextButton(
            onPressed: () {
              setState(() {
                _counter++;
              });
            },
            child: const Text('Increment counter'),
          ),
          const Padding(padding: EdgeInsets.all(8)),
          if (widget.param != null)
            Text('Parameter: ${widget.param!}',
                style: Theme.of(context).textTheme.titleMedium),
          const Padding(padding: EdgeInsets.all(8)),
          if (widget.extra != null)
            Text('Extra: ${widget.extra!}',
                style: Theme.of(context).textTheme.titleMedium),
        ],
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>
</details>


### Logs

<details open><summary>Logs</summary>

```console
lib/app/router/router_builder.g.dart:321:46: Error: Required named parameter 'id' must be provided.
      const HomeStatefulShellRouteC();
                                             ^
lib/app/router/router_builder.dart:183:3: Context: Found this candidate, but the arguments don't match.
  HomeStatefulShellRouteC({required this.id});
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.2, on macOS 15.2 24C101 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.96.3)
[✓] Connected device (5 available)
[✓] Network resources

• No issues found!
```

</details>