-
Notifications
You must be signed in to change notification settings - Fork 125
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
[gql_code_builder] fix: vars_create_factories handle BuiltList type #447
[gql_code_builder] fix: vars_create_factories handle BuiltList type #447
Conversation
213bd98
to
8f3a467
Compare
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.
please also add a test with a list input in the end to end test repo so we don't break that again in a refactor
/// "$BuiltList" is a String "BuiltList<dynamic>" and | ||
/// [g.returns!.symbol!] returns "BuiltList" | ||
/// so we cannot use equality operator here. | ||
final isBuiltList = g.returns?.symbol != null |
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 also check the URL of the reference is from built_value, so we cannot have false positives here?
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.
Good call, I thought of doing that too to find Built
Types at one point (when I wrote some of that code), but I think I didn't end up doing that as it was extremely hard to pin down the correct import.
For BuiltList
s though, this would be checking for the built_lists import though, which doesn't change as often, right?
An alternative that might be worth exploring though, would be to check if all BuiltList
instances are of type ListType
and ListType
is exclusively used for BuiltLists
. Then you could "simply" add another check to L47
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 the url
of the Reference
should be '"package:built_collection/built_collection.dart", I think this could just be added additionally to this check to avoid clashes with types from the schema, which theoretically also could contain symbols that contain the name BuiltList
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.
Done ✅
@@ -165,7 +165,7 @@ class SubscriptionData extends GraphQLSocketMessage { | |||
int get hashCode => toJson().hashCode; | |||
|
|||
@override | |||
bool operator ==(dynamic other) => | |||
bool operator ==(Object other) => |
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.
Is this an unrelated change?
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.
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.
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.
yes, it's likely a new default lint rule in dart
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.
yes, this was the change dart-lang/sdk@aad9e57
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 couldn't find that 😅
Hi! 👋
I've tried to use that feature vars_create_factories and I've encounter an issue with arguments being lists. The parameter of a factory requires a
BuiltList
that is assigned toListBuilder
and that is not allowed.@caffeineflo I've found some solution. Not sure whether it's the best way, but it works for me. So if you could take a look 🙏