refetch method

Future<QueryResult<TParsed>?> refetch()

Attempts to refetch on the network, throwing error if not refetch safe

NOTE: overrides any present non-network-only FetchPolicy, as refetching from the cache does not make sense.

Implementation

Future<QueryResult<TParsed>?> refetch() async {
  if (isRefetchSafe) {
    addResult(QueryResult.loading(
      data: latestResult?.data,
      options: options,
    ));
    return await queryManager.refetchQuery<TParsed>(queryId);
  }
  throw Exception('Query is not refetch safe');
}