From 213bd988b452ca6f06846937d12c4b36529e3601 Mon Sep 17 00:00:00 2001 From: LiLatee Date: Fri, 16 Feb 2024 17:47:14 +0100 Subject: [PATCH] fix: vars_create_factories handle BuiltList type --- .../lib/src/required_vars_constructor.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/codegen/gql_code_builder/lib/src/required_vars_constructor.dart b/codegen/gql_code_builder/lib/src/required_vars_constructor.dart index 7c5711f9..57782f4b 100644 --- a/codegen/gql_code_builder/lib/src/required_vars_constructor.dart +++ b/codegen/gql_code_builder/lib/src/required_vars_constructor.dart @@ -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" 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;