Global configuration for the deadline_future package.
All properties are static so there is no need to pass a config object around — just set them once at app startup:
void main() {
// Enable caching, set a 5-minute default TTL, verbose logging in debug.
DeadlineConfig.enableGlobalCache = true;
DeadlineConfig.defaultCacheTtl = const Duration(minutes: 5);
DeadlineConfig.maxCacheEntries = 500;
DeadlineConfig.logLevel = kDebugMode
? DeadlineLogLevel.info
: DeadlineLogLevel.silent;
runApp(const MyApp());
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
- cacheSize → int
-
Returns the current number of live (non-expired) cache entries.
no setter
- defaultCacheTtl ↔ Duration?
-
Default time-to-live applied to every cache entry when the individual
cacheTtlparameter ofwithDeadlineis not provided.getter/setter pair - enableGlobalCache ↔ bool
-
Whether the internal
DeadlineCacheis active.getter/setter pair - ignoreErrorsAfterDeadline ↔ bool
-
Whether errors emitted by the original Future after the deadline
has already been resolved are silently ignored.
getter/setter pair
- logLevel ↔ DeadlineLogLevel
-
Controls how much diagnostic output
deadline_futureproduces.getter/setter pair - maxCacheEntries ↔ int
-
Maximum number of entries the internal cache may hold simultaneously.
getter/setter pair
Static Methods
-
clearCache(
) → void - Clears the entire internal cache without touching other config.
-
evictCacheEntry(
String key) → void -
Evicts a single entry from the cache by
key. -
reset(
) → void - Resets all configuration fields to their default values and clears the internal cache.