Skip to content

Conversation

@CaoGiaHieu-dev
Copy link
Contributor

@CaoGiaHieu-dev CaoGiaHieu-dev commented Jan 10, 2025

Fixed handling of invalid parameters

Fix: flutter/flutter#160894 (comment)

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@google-cla
Copy link

google-cla bot commented Jan 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@CaoGiaHieu-dev CaoGiaHieu-dev changed the title Handle invaild params [go_router_builder]: Handle invaild params Jan 10, 2025
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.

I think the solution sounds good to me, left some comments

static PersonRoute _fromState(GoRouterState state) => PersonRoute(
state.pathParameters['fid']!,
int.parse(state.pathParameters['pid']!),
int.parse(state.pathParameters['pid']!.toString())!,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you revert the format change?

Copy link
Contributor Author

@CaoGiaHieu-dev CaoGiaHieu-dev Jan 11, 2025

Choose a reason for hiding this comment

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

currently i cannot revert it because it was using same code gen with tryPrase case .
i will look around and try to resolve this

@chunhtai chunhtai requested a review from hannah-hyj January 10, 2025 19:45
param: state.uri.queryParametersAll['param']?.map(int.parse) ??
param: (state.uri.queryParametersAll['param']
?.map(int.parse)
?.where((e) => e != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think ? after the first ?.map may cause lint error as it is not needed?

Copy link
Contributor Author

@CaoGiaHieu-dev CaoGiaHieu-dev Jan 18, 2025

Choose a reason for hiding this comment

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

it wont because it not different with previous code . the only thing different is i wrap it to () and add ?.where((e) => e != null)

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant shouldn't this be
(state.uri.queryParametersAll['param']
?.map(int.parse)
.where((e) => e != null)

Copy link
Member

Choose a reason for hiding this comment

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

@CaoGiaHieu-dev it looks like code here is still not updated. chaining ?. is not needed, see dart doc here: https://dart.dev/null-safety/understanding-null-safety#smarter-null-aware-methods
you nee to update [type_helpers.dart] and regenerate the expect file here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@hannah-hyj i just updated . can you check it again

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 except for the comment #8405 (comment)

@CaoGiaHieu-dev
Copy link
Contributor Author

LGTM except for the comment #8405 (comment)

Thank for your comment . i just updated

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, except #8405 (comment)

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, thanks!

@chunhtai chunhtai added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 24, 2025
@auto-submit auto-submit bot merged commit 35b816f into flutter:main Feb 26, 2025
82 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Feb 27, 2025
github-merge-queue bot pushed a commit to flutter/flutter that referenced this pull request Feb 27, 2025
flutter/packages@c44c228...01d3d5c

2025-02-27 [email protected] Manual roll Flutter from
043b719 to 1659206 (19 revisions) (flutter/packages#8728)
2025-02-27 [email protected] Manual roll Flutter from 911aa75
to 043b719 (flutter/packages#8693)
2025-02-26 [email protected] Dependabot to update major and minor
versions of test dependencies, ignore patch (flutter/packages#8712)
2025-02-26 [email protected] [local_auth] Update to use
flutter.targetSdkVersion (flutter/packages#8695)
2025-02-26 [email protected]
[go_router_builder]: Handle invaild params (flutter/packages#8405)
2025-02-26 [email protected] [pigeon] Timestamp test steps in CI
(flutter/packages#8716)
2025-02-26 [email protected]
[camera_android_camerax] Fix 90°-off preview rotation
(flutter/packages#8629)
2025-02-26 [email protected] [go_router]
Secured empty matches in canPop (flutter/packages#8557)
2025-02-26 [email protected] [tool] Update targetsdk version to 35
from 32 (flutter/packages#8694)
2025-02-26 [email protected] [various] Bump androidx.test:core to
1.4.0 (flutter/packages#8710)
2025-02-26 [email protected] [camera] Disable flaky tests
(flutter/packages#8708)
2025-02-26 [email protected] [url_launcher][web] Prevent browser from
navigating when followLink isn't called (flutter/packages#8675)
2025-02-26 [email protected] [various] Remove plugin-level
`integration_test` dependencies (flutter/packages#8711)
2025-02-26 [email protected] [ci] Lengthen custom tests timeout
(flutter/packages#8715)

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
auto-submit bot pushed a commit that referenced this pull request Mar 4, 2025
…ed to the parameter type 'String' because 'String?' ` on path and query params (#8737)

Impact of this pr #8405 , params with required enum cannot parse

Fixed : flutter/flutter#164354
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
androidseb pushed a commit to androidseb/packages that referenced this pull request Jun 8, 2025
…ed to the parameter type 'String' because 'String?' ` on path and query params (flutter#8737)

Impact of this pr flutter#8405 , params with required enum cannot parse

Fixed : flutter/flutter#164354
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…ed to the parameter type 'String' because 'String?' ` on path and query params (flutter#8737)

Impact of this pr flutter#8405 , params with required enum cannot parse

Fixed : flutter/flutter#164354
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_builder

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[go_router_builder] Cannot handle query parameter when it cannot parse

3 participants