feat: Implement image cache eviction for S3 images and enhance image loading error handling.

This commit is contained in:
pradeepkumar
2026-03-14 15:26:08 +05:30
parent ad94db5620
commit 7b9c19ec67
4 changed files with 53 additions and 35 deletions

View File

@@ -1,4 +1,3 @@
import 'package:dio/dio.dart';
import 'package:real_estate_mobile/core/network/api_client.dart';
/// Resolves S3 keys to presigned download URLs via the backend API.
@@ -54,10 +53,16 @@ class ImageUrlResolver {
return data['url'] as String?;
}
return null;
} on DioException {
} catch (_) {
return null;
}
}
void clearCache() => _cache.clear();
/// Evict a single key from the in-memory cache so the next resolve
/// fetches a fresh presigned URL.
void evict(String? key) {
if (key != null) _cache.remove(key);
}
}