resolveFor method

StaleTime resolveFor(
  1. Query<Object?> query
)

This with any StaleTime.dynamic layer peeled off for query, so the result is one of StaleTimeDuration, StaleTimeStatic or StaleTimeInfinite.

Callers that need more than one fact about a stale time resolve once and then ask the result — a dynamic stale time is user code, and calling it twice per decision would be visible to whoever wrote it.

Implementation

StaleTime resolveFor(Query<Object?> query) => switch (this) {
      StaleTimeDynamic(:final compute) => compute(query).resolveFor(query),
      _ => this,
    };