invalidateCache method
Invalidates a specific cached response.
uri: The URI path of the request to invalidatemethod: The HTTP method of the request to invalidatebody: The body of the request to invalidate (for POST/PUT requests)
This removes a specific entry from the cache, requiring a fresh network request for subsequent calls with the same parameters.
Implementation
void invalidateCache({
required String uri,
required REQUEST_METHODS method,
Object? body,
}) {
final fullUrl = Uri.parse('$baseUrl$uri');
final key = _keyGenerator.generateKey(
method: method,
url: fullUrl,
body: body,
);
_cache.remove(key);
}