-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#4627Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Is there an existing issue for this?
- I have searched the existing package issues
- I have read the guide to filing a bug
What package does this bug report belong to?
go_router_builder
What target platforms are you seeing this bug on?
Android, iOS, Web, macOS, Linux, Windows
Have you already upgraded your packages?
Yes
Dependency versions
pubspec.lock
[Paste file content here]
Steps to reproduce
- install
go_router: 10.0.0
go_router_builder: 2.2.3
- make a ShellRoute without const constructor
@TypedShellRoute<AppShell>(
routes: <TypedRoute<RouteData>>[
],
)
class AppShell extends ShellRouteData {
@override
Widget builder(BuildContext context, GoRouterState state, Widget navigator) {
// TODO: implement builder
return AppLayout(
child: navigator,
);
}
}- run code generation
flutter pub run build_runner build --delete-conflicting-outputs
Expected results
The expected result is that the generated source compiles
Actual results
The generated source does not compile because the builder adds const keyword when it generates the code.
Code sample
Code sample
/// AppShell without const constructor
class AppShell extends ShellRouteData {
@override
Widget builder(BuildContext context, GoRouterState state, Widget navigator) {
// TODO: implement builder
return AppLayout(
child: navigator,
);
}
}
/// Generated code that does not compile because of the const keyword
extension $AppShellExtension on AppShell {
static AppShell _fromState(GoRouterState state) => const AppShell();
}
Screenshots or Videos
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 14.0 23A5286i darwin-arm64, locale en-NG)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.3)
[✓] VS Code (version 1.80.1)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!bartekpacia
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listfound in release: 3.10Found to occur in 3.10Found to occur in 3.10found in release: 3.13Found to occur in 3.13Found to occur in 3.13has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: go_router_builderThe go_router_builder packageThe go_router_builder packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.