diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fdf972..13d50f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,3 +18,7 @@ ## 0.0.5 - introduce custom disposer for the value + +## 0.0.6 + +- Fix the issue with value getter diff --git a/README.md b/README.md index 81883ef..d3bd489 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Integrate `ever_cache` into your project effortlessly. Just sprinkle this into y ```yaml dependencies: - ever_cache: ^0.0.4 + ever_cache: ^0.0.6 ``` then run `pub get` or `flutter pub get`. diff --git a/lib/src/ever_cache_base.dart b/lib/src/ever_cache_base.dart index 3a48c08..b3c42c0 100644 --- a/lib/src/ever_cache_base.dart +++ b/lib/src/ever_cache_base.dart @@ -87,12 +87,14 @@ final class EverCache extends ILockable { /// If the value is not yet computed, it will be fetched in the background as soon as possible. @override T get value { - if (_isDisposed) { + if (disposed) { throw const EverStateException('Value has been disposed.'); } - if (_value == null) { - computeSync(); + if (!computed) { + if (!computing) { + computeSync(); + } if (placeholder != null) { return placeholder!(); @@ -133,7 +135,7 @@ final class EverCache extends ILockable { throw const EverStateException('Value is being evaluated.'); } - if (_value != null && !force) { + if (computed && !force) { return true; } @@ -169,7 +171,7 @@ final class EverCache extends ILockable { throw const EverStateException('Value is being evaluated.'); } - if (_value != null && !force) { + if (computed && !force) { return; } diff --git a/pubspec.yaml b/pubspec.yaml index 3758d82..01f08d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: ever_cache description: Allows to cache a computed value for a specific duration. -version: 0.0.5 +version: 0.0.6 repository: https://github.com/ArunPrakashG/ever_cache environment: