Description
Steps to reproduce
- A file that has your base route: home_route.dart or something that has your root route.
- Add a sub route under that route. that is defined somewhere else.
i.e.:
@TypedGoRoute<DefaultHomePageRoute>(
path: '/',
routes: [
TypedGoRoute<HomePageRoute>(path: HOME_ROUTE, name: HOME_ROUTE_NAME),
TypedGoRoute<InternalAccountHomePageRoute>(
path: InternalAccountHomePageRoute.route,
),
...
Because of the mixins, you can't have InternalAccountHomePageRoute in a separate file correctly with the mix in, especially if you have shared pages in a separate project as an example.
And if you then put InternalAccountHomePageRoute attribute on the route in the file that has this, then it generates the part file for that, but then that can't be included in the routes: [] array because it requires constants, but the builder generates a property instead of a const value for the route that is generated.
Expected results
Should be able to generate each route in a separate file with an attribute, and then on the parent pages reference the child routes under it properly.
Actual results
Errors because not a const route. (which it appears it could be easily)
Code sample
Code sample
@TypedGoRoute(
path: '/',
routes: [
TypedGoRoute(path: HOME_ROUTE, name: HOME_ROUTE_NAME),
TypedGoRoute(
path: InternalAccountHomePageRoute.route,
),
...
This is how it used to be able to be done prior to 3.0.0. But this doesn't work anymore because of the mixin that is now required on routes which then breaks routes that are defined in shared projects (i.e. if you have multiple apps that share the same login page or something).
So if you then try and use the RouteBase get $defaultHomePageRoute => GoRouteData.$route(...);
This isn't constant so then it blows up.
We need this to be constant, or we need another way to create a hierarchical routing that doesn't break this and handles the shared project case.
</details>
### Screenshots or Video
<details open>
<summary>Screenshots / Video demonstration</summary>
[Upload media here]
</details>
### Logs
<details open><summary>Logs</summary>
```console
n/a
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.32.2, on Microsoft Windows [Version 10.0.26100.4349], locale
en-US)
[√] Windows Version (Windows 11 or higher, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.5)
[√] Android Studio (version 2024.3)
[√] VS Code (version 1.101.0)
[√] Connected device (3 available)
[√] Network resources