-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[go_router_builder] Support extension types #9458
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
return '$stateValue as $castType'; | ||
} | ||
|
||
final String parseTypeName = |
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.
Should we guard against no primitive type? since this is following by a hardcode tryParse, may as well only allow certain numeric types?
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.
I think you are right in pointing this out. I restricted the type and handled it correctly. 61901a3
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, just need an example
@@ -334,7 +334,7 @@ class RedirectRoute extends GoRouteData { | |||
|
|||
## Type conversions | |||
|
|||
The code generator can convert simple types like `int` and `enum` to/from the | |||
The code generator can convert simple types like `int`, `enum`, and `extension type` to/from the |
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.
We should add a new example in example/
folder
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, thank you for writing the examples!
@@ -0,0 +1,408 @@ | |||
// Copyright 2013 The Flutter Authors. All rights reserved. |
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.
typo in the file name: typs-> types
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.
Sorry! I fixed. c57f3d0
@@ -263,6 +264,94 @@ class _TypeHelperEnum extends _TypeHelperWithHelper { | |||
bool _matchesType(DartType type) => type.isEnum; | |||
} | |||
|
|||
/// A type helper for extension types. | |||
/// Suppoted extension types are: |
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.
nit: Suppoted-> Supported
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.
Sorry, I fixed! c57f3d0
@koji-1009 You had a failure that I just reran. If it still fails, can you take a look? Maybe you just need to push a merge commit / rebase. |
@justinmc
This “NEXT” section was described at #9453. Because of this, go_router_builder is in a difficult situation for minor version upgrades until the I believe that the problem of |
fix flutter/flutter#170870
Extended
type_helpers.dart
to support Dart extension types.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