isCached method

Future<bool> isCached(
  1. String url
)

Check if a URL is cached

Uses URL normalization to ensure same URL = same cache entry. Returns true if model exists in Cache API.

Implementation

Future<bool> isCached(String url) async {
  try {
    final normalizedUrl = UrlUtils.normalizeUrl(url);
    final cached = await _cacheInterop.has(cacheName, normalizedUrl);

    if (kDebugMode) {
      debugPrint(
          '[WebCacheService] 🔍 isCached($url) -> $cached (normalized: $normalizedUrl)');
    }

    return cached;
  } catch (e) {
    debugPrint('[WebCacheService] ❌ isCached failed for $url: $e');
    return false;
  }
}