isStale method
Returns whether data is missing, invalidated, or outside freshness.
Implementation
bool isStale([QueryFreshness? freshness, DateTime? now]) {
if (!state.hasData || state.isInvalidated) return true;
return switch (freshness ?? options.freshness) {
QueryStaticData() || QueryNeverStale() => false,
QueryStaleAfter(:final duration) =>
(now ?? client.scheduler.now()).difference(state.dataUpdatedAt!) >=
duration,
};
}