feat: Implement image cache eviction for S3 images and enhance image loading error handling.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user