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 large Duration.

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

hashCode int
The hash code for this object.
no setterinherited
length int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cache(String key, Object value, {Duration? cacheDuration}) → void
clear() → void
get(String? key) Object?
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

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