writeQuery<TData, TVars> method Null safety

void writeQuery<TData, TVars>(
  1. OperationRequest<TData, TVars> request,
  2. TData data,
  3. {OperationRequest? optimisticRequest}

Normalizes data for the given operation and writes it to the Store.

If an optimisticRequest is provided, the changes will be written as an optimistic patch and will be reverted once a non-optimistic response is received for the optimisticRequest.


void writeQuery<TData, TVars>(
  OperationRequest<TData, TVars> request,
  TData data, {
  OperationRequest? optimisticRequest,
}) {
    read: optimisticRequest != null
        ? optimisticReader
        : (dataId) => store.get(dataId),
    write: (dataId, value) => _writeData(
    document: request.operation.document,
    operationName: request.operation.operationName,
    // TODO: don't cast to dynamic
    variables: (request.vars as dynamic)?.toJson(),
    data: (data as dynamic)?.toJson(),
    typePolicies: typePolicies,
    addTypename: addTypename,
    dataIdFromObject: dataIdFromObject,
    possibleTypes: possibleTypes,