revalidate method

int revalidate({
  1. bool onlyStale = true,
})

Refetches every watched, settled query that is not already in flight, and returns how many it started. With onlyStale true (the default) only queries that aged past their staleTime are refetched. Driven by the freshness installers.

Implementation

int revalidate({bool onlyStale = true}) {
  var started = 0;

  for (final record in _records.values.toList()) {
    if (record.listeners.isEmpty || !record.settled) continue;
    if (record.inflight != null) continue;
    if (onlyStale && !_expired(record)) continue;

    _detach(_start(record));
    started++;
  }

  return started;
}