Skip to content

Commit

Permalink
fix null case
Browse files Browse the repository at this point in the history
  • Loading branch information
smkhalsa committed Feb 4, 2020
1 parent 551abfb commit 0c00314
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gql_code_builder/lib/src/operation/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ String _operationType(
DocumentNode schema,
OperationDefinitionNode op,
) {
final schemaDef = schema.definitions.whereType<SchemaDefinitionNode>().first;
if (schemaDef == null) return defaultRootTypes[op.type];
return schemaDef.operationTypes
final schemaDefs = schema.definitions.whereType<SchemaDefinitionNode>();
if (schemaDefs.isEmpty) return defaultRootTypes[op.type];
return schemaDefs.first.operationTypes
.firstWhere((opType) => opType.operation == op.type)
.type
.name
Expand Down

0 comments on commit 0c00314

Please sign in to comment.