Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added static field defaultCacheManager to CachedNetworkImageProvider #933

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 BaseCacheManager 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