fieldNode function

FieldNode fieldNode(
  1. String name, {
  2. Iterable selectionSet = const [],
})

Implementation

FieldNode fieldNode(String name, {Iterable selectionSet = const []}) {
  return FieldNode(
      name: name.toNameNode(),
      selectionSet: SelectionSetNode(
        selections: [
          for (var selection in selectionSet)
            if (selection is String)
              if (selection.startsWith("..."))
                FragmentSpreadNode(name: selection.substring(3).toNameNode())
              else
                FieldNode(name: selection.toNameNode())
            else if (selection is SelectionNode)
              selection
            else
              illegalState("Invalid selectionSet type: ${selection.runtimeType}"),
        ],
      ));
}