ub3lal 2 weeks ago
parent
commit
3c5f9eff2f
2 changed files with 7 additions and 2 deletions
  1. 6 1
      lib/src/CashedNetworkImageWidget.dart
  2. 1 1
      pubspec.yaml

+ 6 - 1
lib/src/CashedNetworkImageWidget.dart

@@ -125,6 +125,7 @@ class CachedNetworkImageProvider
   final Widget? placeholder;
   final Widget? errorWidget;
   final bool cached;
+  final bool useUrl = false;
   final String? cacheKey;
   final Widget? loadwidget;
   final Map<String, String>? httpHeaders;
@@ -179,7 +180,11 @@ class CachedNetworkImageProvider
         if (cacheKey != null) {
           fileInfo = await defaultCacheManager.getFileFromCache(cacheKey!);
         } else {
-          fileInfo = await defaultCacheManager.getFileFromCache(imageUrl);
+          if (useUrl) {
+            fileInfo = await defaultCacheManager.getFileFromCache(imageUrl);
+          } else {
+            throw Exception('Failed to load image');
+          }
         }
 
         if (fileInfo != null) {

+ 1 - 1
pubspec.yaml

@@ -1,6 +1,6 @@
 name: network_image_cached
 description: "Network image"
-version: 0.0.5
+version: 0.0.6
 homepage:
 
 environment: