Skip to content

Commit

Permalink
fix: vars_create_factories handle BuiltList type
Browse files Browse the repository at this point in the history
  • Loading branch information
LiLatee committed Feb 16, 2024
1 parent fa44d74 commit 213bd98
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions codegen/gql_code_builder/lib/src/required_vars_constructor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,15 @@ Constructor builtCreateConstructor({
final assignments = filteredGetters.map((g) {
final typeDefinitionNode = getTypeDefinitionNode(
schemaSource.document, g.returns!.symbol!.replaceFirst("G", ""));
/// "$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
? "$BuiltList".contains(g.returns!.symbol!)
: false;
final isBuiltType = typeDefinitionNode is InputObjectTypeDefinitionNode ||
typeDefinitionNode is ScalarTypeDefinitionNode;

typeDefinitionNode is ScalarTypeDefinitionNode ||
isBuiltList;
final isTypeOverride = typeOverrides.values.contains(g.returns!);
final isNullable = (g.returns! as TypeReference).isNullable ?? false;

Expand Down

0 comments on commit 213bd98

Please sign in to comment.