fetchMore method

Future<QueryResult<TParsed>> fetchMore(
  1. FetchMoreOptions fetchMoreOptions
)

fetch more results and then merge them with the latestResult according to FetchMoreOptions.updateQuery.

The results will then be added to to stream for listeners to react to, such as for triggering grahphql_flutter widget rebuilds

NOTE: with the addition of strict data structure checking in v4, it is easy to make mistakes in writing updateQuery.

To mitigate this, FetchMoreOptions.partial has been provided.

Implementation

Future<QueryResult<TParsed>> fetchMore(
    FetchMoreOptions fetchMoreOptions) async {
  addResult(QueryResult.loading(
    data: latestResult?.data,
    options: options,
  ));

  return fetchMoreImplementation(
    fetchMoreOptions,
    originalOptions: options,
    queryManager: queryManager,
    previousResult: latestResult!,
    queryId: queryId,
  );
}