setOptions method

void setOptions(
  1. InfiniteQueryOptions<TPage, TPageParam> value
)

Updates future fetches and paging controls without remounting the same key.

Implementation

void setOptions(InfiniteQueryOptions<TPage, TPageParam> value) {
  final previous = current;
  final previousOptions = _options;
  _options = value;
  try {
    _observer.setOptions(value.queryOptions);
  } on Object {
    _options = previousOptions;
    rethrow;
  }
  // Paging controls may change even when the underlying query result does not.
  final next = current;
  if (next.query == previous.query &&
      (next.hasNextPage != previous.hasNextPage ||
          next.hasPreviousPage != previous.hasPreviousPage)) {
    for (final listener in List<void Function()>.of(_listeners)) {
      listener();
    }
  }
}