PodBuilderCacheManager class final
Process-wide value cache for keyed builders (PodBuilder / PodListBuilder).
Scope warning: this is a singleton. Two PodBuilders anywhere in
the app with the same key share entries. The type-cast on read
(cached is Result<T>) prevents type confusion across mismatched
types, but you can still see silent cross-screen value sharing if two
widgets reuse a Key. Prefer scoped, unique keys (ValueKey('feature:patientId'))
over short generic ones.
Expiration semantics:
cacheDuration > 0: entry expires after the duration; eviction is lazy (the next get notices the timestamp has passed and clears both maps).cacheDuration == Duration.zero: stored but immediately evicted on first get — effectively "no cache."cacheDuration == null: the store is skipped entirely. Callers that want unbounded caching should pass an explicit largeDuration.
Expiration is lazy: no Timer is scheduled — the next get for a
key sees the timestamp has passed and evicts. Avoids leaving real
timers pending in flutter_test.
Properties
Methods
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- i → PodBuilderCacheManager
-
final
- maxEntries ↔ int
-
Hard cap on simultaneously-cached entries. When the cap is reached
on a new-key insert, the oldest entries (insertion-order) are
evicted to make room.
getter/setter pair