ProviderQuotaService class

Implemented types

Constructors

ProviderQuotaService({Map<String, QuotaAdapter> adapters = const {}, Set<String> unmeteredProviders = const {}, DateTime now()?, Duration ttl = const Duration(minutes: 15), Duration fetchTimeout = const Duration(seconds: 5)})

Properties

changes → Stream<void>
Fires after every completed fetch or prune; UI surfaces listen to this instead of polling.
no setter
fetchTimeout → Duration
Hard bound on every adapter fetch: a hung endpoint degrades to an unknown (timeout) entry instead of wedging /quota refresh, pull-to-refresh, or the background kick (review round 1).
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
ttl → Duration
final

Methods

hasSource(String providerId) → bool
True when providerId has any quota surface at all — an adapter or a static unmetered marking. Badge render paths gate on this so adapter-less providers never show a stuck [XX …] badge.
isDepleted(String providerId) → bool
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
peek(String providerId) → QuotaFetchResult?
Synchronous, cache-only read for render paths (badge, /quota, app). Returns null when the entry is cold/expired — a background refresh is kicked in that case and the surface renders ….
quotaFor(String providerId, {bool forceRefresh = false}) → Future<QuotaFetchResult>
Awaiting read: returns cached when fresh, else fetches (coalesced).
refresh(String providerId) → Future<QuotaFetchResult>
Forces one fetch, coalesced with any in-flight fetch (E3: exactly one attempt per refresh).
retainOnly(Set<String> providerIds) → void
Drops cache entries for providers no longer configured (E5).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited