ApiCacheHelper class abstract interface

A class responsible for managing caching of API data.

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

clearAllCache() Future<void>
Clears all cached data stored by the API Cache Manager asynchronously. Returns: A future that completes when all cached data is successfully cleared.
clearCache(String url) Future<bool>
Clears cached data associated with the provided URL asynchronously. Parameters: url: The URL for which cached data is to be cleared. Returns: A future that completes with a boolean value indicating the success of the cache clearing operation. Returns true if cached data is successfully cleared for the URL, otherwise false.
getCacheData(String url, {Duration? maxAge}) Future<APICacheDBModel?>
Retrieves cached data corresponding to the provided URL asynchronously. Parameters: url: The URL for which cached data is requested. maxAge: optional freshness window. If the cached entry is older than maxAge, it is treated as a miss — the stale entry is cleared and null is returned instead of stale data. Omit to return cached data regardless of age (previous behaviour). Returns: A future that completes with the cached data associated with the URL, if available. If no cached data is found for the URL, returns null.
isCacheExist(String url) Future<bool>
Checks whether cached data exists for the provided URL asynchronously. Parameters: url: The URL for which cached data existence is to be checked. Returns: A future that completes with a boolean value indicating whether cached data exists for the URL. Returns true if cached data exists for the URL, otherwise false.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setCacheData(String url, String data) Future<bool>
Sets cached data for the provided URL with the given data asynchronously. Parameters: url: The URL for which data is to be cached. data: The data to be cached. Returns: A future that completes with a boolean value indicating the success of the caching operation. Returns true if the data is successfully cached, otherwise false.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance ApiCacheHelper
Define a static getter for accessing the singleton instance of ApiCacheHelper. If the instance is not already initialized, create a new one using the factory constructor. Return the existing or newly created instance.
no setter