shouldCache static method

bool shouldCache(
  1. Request request
)

Parse a request and determines what OperationType it is If the statement evaluates to true it is a mutation

Implementation

static bool shouldCache(Request request) {
  final node = request.operation.document.definitions.first;
  final policy = request.context.entry<OfflineFirstGraphqlPolicy>()?.upsert;
  final isMutation = node is OperationDefinitionNode && node.type == OperationType.mutation;
  return isMutation && policy != OfflineFirstUpsertPolicy.requireRemote;
}