Skip to content

[go_router] Fix return type of current state getter to be non-nullable #8173

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

Merged

Conversation

kaboc
Copy link
Contributor

@kaboc kaboc commented Nov 25, 2024

The state getter returns a GoRouterState?, but I don't think it needs to be nullable since currentConfiguration.last.buildState() never returns null.

I'm not sure if it is nullable on purpose for some changes planned in the Future. If there is a reason, it might be better to add a comment about it. Otherwise, it is just inconvenient that a null check is necessary.

Pre-launch Checklist

@kaboc
Copy link
Contributor Author

kaboc commented Nov 25, 2024

Ah, is this a breaking change...? I'll revert the "Update version" commit if this fix should be included in the next major version rather than being released as a patch version.

@chunhtai
Copy link
Contributor

Ah, is this a breaking change...? I'll revert the "Update version" commit if this fix should be included in the next major version rather than being released as a patch version.

no, I don't think so, at worse it will just generate a lint warning when the customer's code treats it as nullable

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chunhtai chunhtai requested a review from hannah-hyj November 25, 2024 19:22
Copy link
Member

@hannah-hyj hannah-hyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hannah-hyj hannah-hyj added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2024
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Dec 18, 2024
Copy link
Contributor

auto-submit bot commented Dec 18, 2024

auto label is removed for flutter/packages/8173, due to - The status or check suite Mac_x64 build_all_packages master has failed. Please fix the issues identified (or deflake) before re-applying this label.

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 23, 2025
@auto-submit auto-submit bot merged commit c9347b8 into flutter:main Jan 23, 2025
77 checks passed
@kaboc kaboc deleted the go-router-fix-state-getter-nullability branch January 24, 2025 00:21
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 24, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 27, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Jan 27, 2025
flutter/packages@3d3ab7b...258f6dc

2025-01-24 [email protected] [shared_preferences] Add shared
preferences devtool (flutter/packages#8494)
2025-01-24 [email protected] [shared_preferences] update List<String>
encode/decode (flutter/packages#8335)
2025-01-24 [email protected] Manual roll Flutter from
c1561a4 to c1ffaa9 (21 revisions) (flutter/packages#8498)
2025-01-24 [email protected] [ios_platform_images] Switch to
`loadImage` (flutter/packages#8216)
2025-01-24 [email protected] [camera] Remove OCMock from
CameraExposureTests and CameraFocusTests (flutter/packages#8351)
2025-01-24 [email protected] [shared_preferences] Tool for migrating
from legacy shared_preferences to shared_preferences_async
(flutter/packages#8229)
2025-01-23 [email protected] Revert "[shared_preferences] Add
shared preferences devtool" (flutter/packages#8493)
2025-01-23 [email protected] [go_router] Fix
return type of current state getter to be non-nullable
(flutter/packages#8173)
2025-01-23 [email protected] Manual roll Flutter from
b2f515f to c1561a4 (18 revisions) (flutter/packages#8491)
2025-01-23 [email protected] [pigeon] fixes event channel dart
instance name usage and adds test (flutter/packages#8483)
2025-01-23 [email protected] [go
_route] fragment parameter added (flutter/packages#8232)
2025-01-23 [email protected] [in_app_purchase] Update
in_app_purchase_android version in in_app_purchase
(flutter/packages#8463)
2025-01-23 [email protected] [image_picker] Reference alternate
macOS implementations (flutter/packages#8487)
2025-01-23 [email protected] [rfw]
Activate leak testing (flutter/packages#8370)
2025-01-23 [email protected]
[video_player] Activate leak testing (flutter/packages#8379)
2025-01-23 [email protected] Manual roll Flutter from
b9e86a5 to b2f515f (42 revisions) (flutter/packages#8482)
2025-01-23 [email protected] [camera] Add API support query for
image streaming (app-facing) (flutter/packages#8422)
2025-01-23 [email protected] Manual roll Flutter from
b9e86a5 to eb6af3d (13 revisions) (flutter/packages#8473)
2025-01-23 [email protected] [shared_preferences] Add shared
preferences devtool (flutter/packages#8322)

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] 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
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
flutter#8173)

The `state` getter returns a `GoRouterState?`, but I don't think it needs to be nullable since `currentConfiguration.last.buildState()` never returns `null`.

I'm not sure if it is nullable on purpose for some changes planned in the Future. If there is a reason, it might be better to add a comment about it. Otherwise, it is just inconvenient that a null check is necessary.
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
flutter#8173)

The `state` getter returns a `GoRouterState?`, but I don't think it needs to be nullable since `currentConfiguration.last.buildState()` never returns `null`.

I'm not sure if it is nullable on purpose for some changes planned in the Future. If there is a reason, it might be better to add a comment about it. Otherwise, it is just inconvenient that a null check is necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App p: go_router
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants