type property

OperationType type

Implementation

OperationType get type {
  final definitions = operation.document.definitions
      .whereType<OperationDefinitionNode>()
      .toList();
  if (operation.operationName != null) {
    definitions.removeWhere(
      (node) => node.name!.value != operation.operationName,
    );
  }
  // TODO differentiate error types, add exception
  assert(definitions.length == 1);
  return definitions.first.type;
}