diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index e8da1fb..8f828b5 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-01-09 17:21:28.653743","version":"3.16.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/redev.rx/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2024-01-09 22:04:18.164722","version":"3.16.5"} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fdc5ab..2eec69b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 0.0.4 + - edit performance ## 0.0.3 - Refactor Download File - Edit Load Image from cache diff --git a/README.md b/README.md index c8b48b6..7f2120e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ and the Flutter guide for ## Getting started ```dart -rxcache_network_image: 0.0.3 +rxcache_network_image: 0.0.4 ``` ## Usage diff --git a/example/pubspec.lock b/example/pubspec.lock index 7870a26..9aea54d 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -209,7 +209,7 @@ packages: path: ".." relative: true source: path - version: "0.0.3" + version: "0.0.4" sky_engine: dependency: transitive description: flutter diff --git a/lib/src/cache_manager/rxcache_manager.dart b/lib/src/cache_manager/rxcache_manager.dart index e70d1b0..814460b 100644 --- a/lib/src/cache_manager/rxcache_manager.dart +++ b/lib/src/cache_manager/rxcache_manager.dart @@ -209,6 +209,7 @@ class RxCacheManager with RxCacheManagerMixing { final Uri resolved = Uri.base.resolve(url ?? ''); final fileName = key ?? resolved.pathSegments.lastOrNull; final mFile = File("$cacheFolder/$fileName.bin"); + if (url == null) return null; try { /// diff --git a/lib/src/rxcache_image_provider.dart b/lib/src/rxcache_image_provider.dart index 703844d..2e89f29 100644 --- a/lib/src/rxcache_image_provider.dart +++ b/lib/src/rxcache_image_provider.dart @@ -132,7 +132,12 @@ class RxCacheImageProvider extends ImageProvider { }, ); - return decode(await ImmutableBuffer.fromUint8List(bytes!)); + if (bytes == null) { + throw NetworkImageLoadException( + statusCode: HttpStatus.badRequest, uri: Uri.parse(url)); + } + + return decode(await ImmutableBuffer.fromUint8List(bytes)); } /// @@ -219,7 +224,12 @@ class RxCacheImageProvider extends ImageProvider { }, ); - return decode(await ImmutableBuffer.fromUint8List(bytes!)); + if (bytes == null) { + throw NetworkImageLoadException( + statusCode: HttpStatus.badRequest, uri: Uri.parse(url)); + } + + return decode(await ImmutableBuffer.fromUint8List(bytes)); } /// diff --git a/pubspec.yaml b/pubspec.yaml index 8f7f8bf..3b66fb7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: rxcache_network_image description: "Easy download image from network and show in widget with rxcacheNetworkImage fast load image from network" -version: 0.0.3 +version: 0.0.4 homepage: https://www.facebook.com/profile.php?id=100094077041664 repository: https://github.com/redevrx/RxCache_network_image