typenameForOperationType function
String
typenameForOperationType(
- OperationType operationType,
- Map<
String, TypePolicy> typePolicies
Implementation
String typenameForOperationType(
OperationType operationType,
Map<String, TypePolicy> typePolicies,
) {
switch (operationType) {
case OperationType.query:
return typePolicies.entries
.firstWhereOrNull(
(entry) => entry.value.queryType,
)
?.key ??
defaultRootTypenames[OperationType.query]!;
case OperationType.mutation:
return typePolicies.entries
.firstWhereOrNull(
(entry) => entry.value.mutationType,
)
?.key ??
defaultRootTypenames[OperationType.mutation]!;
case OperationType.subscription:
return typePolicies.entries
.firstWhereOrNull(
(entry) => entry.value.subscriptionType,
)
?.key ??
defaultRootTypenames[OperationType.subscription]!;
}
}