Skip to content

Commit

Permalink
added static field defaultCacheManager to CachedNetworkImageProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
AurelVU authored and martijn00 committed Jul 31, 2024
1 parent 94d6ab2 commit 0a639ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cached_network_image/lib/src/cached_image_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CachedNetworkImage extends StatelessWidget {
BaseCacheManager? cacheManager,
double scale = 1,
}) async {
final effectiveCacheManager = cacheManager ?? DefaultCacheManager();
final effectiveCacheManager = cacheManager ?? CachedNetworkImageProvider.defaultCacheManager;
await effectiveCacheManager.removeFile(cacheKey ?? url);
return CachedNetworkImageProvider(url, scale: scale).evict();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class CachedNetworkImageProvider
/// CacheManager from which the image files are loaded.
final BaseCacheManager? cacheManager;

/// The default cache manager used for image caching.
static DefaultCacheManager defaultCacheManager = DefaultCacheManager();

/// Web url of the image to load
final String url;

Expand Down Expand Up @@ -113,7 +116,7 @@ class CachedNetworkImageProvider
cacheKey,
chunkEvents,
decode,
cacheManager ?? DefaultCacheManager(),
cacheManager ?? defaultCacheManager,
maxHeight,
maxWidth,
headers,
Expand Down Expand Up @@ -166,7 +169,7 @@ class CachedNetworkImageProvider
cacheKey,
chunkEvents,
decode,
cacheManager ?? DefaultCacheManager(),
cacheManager ?? defaultCacheManager,
maxHeight,
maxWidth,
headers,
Expand Down

0 comments on commit 0a639ae

Please # to comment.