mergeSelectionSets method

SelectionSetContext mergeSelectionSets(
  1. List<SelectionContext> fields
)

Implementation

SelectionSetContext mergeSelectionSets(List<SelectionContext> fields) {
  var selections = <SelectionContext>[];

  for (var field in fields) {
    if (field.field?.selectionSet != null) {
      selections.addAll(field.field!.selectionSet!.selections);
    } else if (field.inlineFragment?.selectionSet != null) {
      selections.addAll(field.inlineFragment!.selectionSet.selections);
    }
  }

  return SelectionSetContext.merged(selections);
}