visitFragmentDefinitionNode method
appends type name to FragmentDefinitionNode
Implementation
@override
FragmentDefinitionNode visitFragmentDefinitionNode(
FragmentDefinitionNode node) {
if (node.selectionSet.selections.isEmpty) {
return node;
}
return FragmentDefinitionNode(
name: node.name,
typeCondition: node.typeCondition,
directives: node.directives,
span: node.span,
selectionSet: SelectionSetNode(
selections: <SelectionNode>[
...node.selectionSet.selections.where((element) =>
(element is! FieldNode) || (element.name.value != typeName)),
FieldNode(name: NameNode(value: typeName)),
],
),
);
}