subfieldConflicts function

Conflict? subfieldConflicts(
  1. List<Conflict> conflicts,
  2. String responseName,
  3. FieldNode node1,
  4. FieldNode node2,
)

Given a series of Conflicts which occurred between two sub-fields, generate a single Conflict.

Implementation

Conflict? subfieldConflicts(
  List<Conflict> conflicts,
  String responseName,
  FieldNode node1,
  FieldNode node2,
) {
  if (conflicts.isNotEmpty) {
    return Conflict(
      ConflictReason(
        responseName,
        conflicts.map((c) => c.reason).toList(),
        null,
      ),
      [node1, ...conflicts.expand((c) => c.fields1)],
      [node2, ...conflicts.expand((c) => c.fields2)],
    );
  }
}