-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[go_router] Add routing functions to GoRouteData #9277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -280,6 +280,76 @@ void main() { | |||
expect(routeWithDefaultCaseSensitivity.caseSensitive, false); | |||
}, | |||
); | |||
|
|||
testWidgets( | |||
'It should throw beacuase there is not code generated', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'It should throw beacuase there is not code generated', | |
'It should throw beacuase there is no code generated', |
@chunhtai @hannah-hyj Thanks for the approval. There are two things that I would appreciate some help with in this PR:
|
6199c70
to
d34520a
Compare
d34520a
to
b37c1ac
Compare
b37c1ac
to
a6745b3
Compare
Hi there, I ran into a compilation error after upgrading to go_router_builder 3.0.0 together with go_router 15.1.3. The generated mixin looks like this: mixin _$SplashRoute on GoRouteData {
static SplashRoute _fromState(GoRouterState state) => const SplashRoute();
@override
String get location => GoRouteData.$location('/');
@override
void go(BuildContext context) => context.go(location);
@override
Future<T?> push<T>(BuildContext context) => context.push<T>(location);
// …and so on
} However, in
It looks like the builder is already generating mixins for methods that are only available in an unreleased version of
Happy to provide a minimal repro if it helps. Thanks for looking into this! |
second step of fixing #106790. First PR
This PR adds the routing methods
.location
,.go(context)
,.push(context)
,.pushReplacement(context)
, andreplace(context)
toGoRouteData
. They will be overridden by the mixin generated bygo_router_builder
Pre-Review Checklist
[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3