query<TParsed> method

Future<QueryResult<TParsed>> query<TParsed>(
  1. QueryOptions<TParsed> options
)

Implementation

Future<QueryResult<TParsed>> query<TParsed>(
    QueryOptions<TParsed> options) async {
  final results = fetchQueryAsMultiSourceResult(_oneOffOpId, options);
  final eagerResult = results.eagerResult;
  final networkResult = results.networkResult;
  if (options.fetchPolicy != FetchPolicy.cacheAndNetwork ||
      eagerResult.isLoading) {
    final result = networkResult ?? eagerResult;
    await result;
    maybeRebroadcastQueries();
    return result;
  }
  maybeRebroadcastQueries();
  if (networkResult is Future<QueryResult<TParsed>>) {
    networkResult.then((value) => maybeRebroadcastQueries());
  }
  return eagerResult;
}