-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[go_router] Add GoRouterState state
parameter to GoRouterData.onExit
#6495
[go_router] Add GoRouterState state
parameter to GoRouterData.onExit
#6495
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.
code LGTM, but we should have a bit more test.
Since this is a breaking change can you write a breaking change doc?
You can also explore dart fix, I think you can add a new rule there to auto migrate customers' code.
@@ -25,7 +25,7 @@ void main() { | |||
path: '1', | |||
builder: (BuildContext context, GoRouterState state) => | |||
DummyScreen(key: page1), | |||
onExit: (BuildContext context) { | |||
onExit: (BuildContext context, GoRouterState state) { |
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.
Can you add a new test that assert the properties in state, to make sure the state is accurate with the route?
See https://github.com/flutter/packages/blob/main/packages/go_router/lib/fix_data.yaml if you can write a rule that cover all cases, the migration doc can be as simple as |
…-to-on-exit # Conflicts: # packages/go_router/CHANGELOG.md # packages/go_router/pubspec.yaml
Okay sure I'll write one ! 👍 |
@chunhtai I'm struggling a bit with the (I also posted a message on discord https://discord.com/channels/608014603317936148/608021635370582020/1228715527073955912) |
I think you can probably reuse some of the code from this example https://github.com/flutter/flutter/blob/2e748e8598b3169d5d186b8a4d02e603b62653d0/packages/flutter/lib/fix_data/fix_cupertino.yaml#L182 |
you can also check the syntax here https://github.com/flutter/flutter/wiki/Data-driven-Fixes |
That's a bit different, it looks like the MyClass.myMethod(param1); into MyClass.myMethod(param1, param2); while I need to add a parameter to a method given as a argument: GoRouter(
onExit: (BuildContext context) => true;
); into GoRouter(
onExit: (BuildContext context, GoRouterState state) => true;
); |
46248ba
to
3b3c61c
Compare
Adds the migration guide for go router v14 (flutter/packages#6495) Fixes flutter/flutter#146805 ## Presubmit checklist - [x] This PR doesn’t contain automatically generated corrections (Grammarly or similar). - [x] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn’t use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [x] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. Co-authored-by: Brett Morgan <[email protected]>
The migration doc flutter/website#10423 got merged |
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, thanks for improving the API!
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
flutter/packages@cf6d280...fde908d 2024-04-25 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.3 to 4.1.4 (flutter/packages#6609) 2024-04-24 [email protected] [go_router] Add `GoRouterState state` parameter to `GoRouterData.onExit` (flutter/packages#6495) 2024-04-24 [email protected] Add CI steps to test iOS and macOS plugins with both CocoaPods and Swift Package Manager (flutter/packages#6557) 2024-04-24 [email protected] Roll Flutter from 77043ba to dba4f77 (30 revisions) (flutter/packages#6607) 2024-04-24 [email protected] [camera] Finish converting iOS to Pigeon (flutter/packages#6601) 2024-04-24 [email protected] [go_router] Fixes an issue where route future does not complete when � (flutter/packages#6596) 2024-04-24 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Bump legacy all_packages project AGP version to 7.0.0, Gradle version to 7.0.2 (#6591)" (flutter/packages#6605) 2024-04-23 [email protected] [in_app_purchase_android] Readme update for Alternative billing (flutter/packages#6578) 2024-04-23 [email protected] Bump legacy all_packages project AGP version to 7.0.0, Gradle version to 7.0.2 (flutter/packages#6591) 2024-04-23 [email protected] Roll Flutter from 140edb9 to 77043ba (21 revisions) (flutter/packages#6599) 2024-04-23 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 3.25.1 to 3.25.2 (flutter/packages#6597) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…it` (flutter#6495) Part of flutter/flutter#137394 I need to add the `state` parameter to the `onExit` method so I can use the `factoryImpl(state)`: https://github.com/flutter/packages/blob/d4cd4f00254b2fdb50767c837ecd27bcbac488cd/packages/go_router/lib/src/route_data.dart#L100-L118
…it` (flutter#6495) Part of flutter/flutter#137394 I need to add the `state` parameter to the `onExit` method so I can use the `factoryImpl(state)`: https://github.com/flutter/packages/blob/d4cd4f00254b2fdb50767c837ecd27bcbac488cd/packages/go_router/lib/src/route_data.dart#L100-L118
Part of flutter/flutter#137394
I need to add the
state
parameter to theonExit
method so I can use thefactoryImpl(state)
:packages/packages/go_router/lib/src/route_data.dart
Lines 100 to 118 in d4cd4f0
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.