juice_storage 2.2.0 copy "juice_storage: ^2.2.0" to clipboard
juice_storage: ^2.2.0 copied to clipboard

Local storage, caching, and secure storage for the Juice framework. Supports Hive CE, SharedPreferences, SQLite, and flutter_secure_storage.

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

2.2.0 - 2026-09-02 #

Added #

  • HiveGateway seam (init / isAdapterRegistered / registerAdapter / openBox) with HiveGatewayImpl as the shipped default, injected through StorageBloc's factory exactly like CacheIndex. InitializeUseCase's hive leg now runs entirely over the seam, so Hive's static init surface is no longer untestable. The gateway is an internal adapter (not exported); the factory parameter exists for test injection.

Fixed #

  • Stale-lock cold boot no longer kills the session silently. A process killed mid-write can leave a Hive box lock that fails exactly one boot. The old catch put the whole session on a dead cache with no log line saying why (observed 2026-09-01: every prefs read throwing CacheIndex not initialized). Hive init now gets ONE bounded retry after 300ms, and a final failure is loud: logged through JuiceLoggerConfig.logError as well as the state's StorageError (backendNotAvailable). Exactly two attempts, never more.

Tests #

  • Three pins on the retry: clean init is one call with no noise; one transient failure heals on the single retry (ready, boxes open, retrying once logged, no error); persistent failure is loud and bounded (error state + StorageError + DEAD this session logged, exactly two attempts).

2.1.0 - 2026-08-13 #

Changed #

  • Updated the core dependency to juice: ^1.6.0.
  • Every use-case builder now declares EventConcurrency.concurrent explicitly. Mutations enter a bloc-wide FIFO and preserve send order across different mutation event types; read-only queries remain genuinely concurrent. TTL reads join the FIFO only when performing lazy eviction.
  • close() now waits for queued storage mutations before closing the cache index.

Tests #

  • Added gated coverage for an overlapping TTL write and delete, proving the delete cannot overtake the write and leave stale expiration metadata.
  • Added gated coverage proving independent reads can overlap.

2.0.0 - 2026-06-16 #

Changed (BREAKING) #

  • Migrated from Hive to Hive CE (hive_ce/hive_ce_flutter) — the original hive is unmaintained; hive_ce is its maintained, drop-in community continuation (same Hive v2 box/adapter API, on-disk format unchanged, so existing boxes keep working). Internally a pure import swap (no codegen change). Breaking only at the type boundary: StorageConfig.hiveAdapters is List<TypeAdapter> and TypeAdapter now comes from hive_ce, so apps registering custom adapters must import package:hive_ce/hive.dart instead of package:hive/hive.dart (no logic changes). Apps that don't use hiveAdapters (the common case) need only the dependency bump.

1.2.0 - 2026-04-18 #

Changed #

  • Updated core dependency to juice: ^1.4.0
  • Refreshed README messaging around lifecycle-aware persistence and cache cleanup

1.1.0 - 2026-02-13 #

Added #

  • hiveKeys helper method - StorageBloc.hiveKeys(box) returns all keys from a Hive box
  • HiveKeysEvent / HiveKeysUseCase - Event-driven Hive key enumeration

Changed #

  • CacheIndex.clock is no longer test-only (@visibleForTesting removed) — accessed by StorageBloc and CacheCleanupUseCase as part of clock wiring

1.0.0 - 2026-02-02 #

Stable Release #

First stable release of juice_storage.

Fixed #

  • Clock wiring - StorageBloc.clock now propagates to CacheIndex, so TTL expiration checks use the overridden clock in tests
  • Background cleanup safety - Timer callback now guards against concurrent runs and catches errors instead of leaving unhandled async exceptions
  • CacheCleanupEvent hang - CacheCleanupEvent(runNow: false) no longer hangs sendForResult due to missing state emission
  • Init error preservation - StorageState.lastError is no longer unconditionally cleared at end of initialization; backend errors are preserved
  • CacheCleanupUseCase clock - Uses cacheIndex.clock() instead of hardcoded DateTime.now() for lastCleanupAt

Changed #

  • Updated dependency: juice: ^1.3.0

Documentation #

  • Fixed secureDeleteAll() references → secureClearAll() (storage-backends, events-reference)
  • Fixed StorageBackendStatus.allReady() → explicit constructor (testing guide)
  • Updated dependency versions in getting-started guide

0.9.0 - 2025-01-12 #

Release Candidate #

Feature-complete release with comprehensive test coverage. API is stabilizing; 1.0.0 will follow after production validation.

Added #

  • SQLite Use Case Tests - Comprehensive test coverage for SQLite operations (27 new tests)
  • Platform Support Documentation - Added platform compatibility table to README

Changed #

  • Updated dependency: juice: ^1.2.0

Breaking Changes #

  • Renamed ResultEvent to StorageResultEvent - Resolves naming conflict with juice core's ResultEvent. If you subclassed ResultEvent, update to extend StorageResultEvent instead.
  • Standardized Hive event parameters - HiveOpenBoxEvent and HiveCloseBoxEvent now use box parameter instead of boxName for consistency with other Hive events.
    • Before: HiveOpenBoxEvent(boxName: 'cache')
    • After: HiveOpenBoxEvent(box: 'cache')
  • Helper method parameter renamed - hiveOpenBox(String boxName) is now hiveOpenBox(String box)

Documentation #

  • Added platform support matrix showing backend availability per platform
  • Web limitations documented for SQLite and Secure Storage

0.8.0 - 2025-01-10 #

Added #

  • StorageBloc - Unified BLoC for managing multiple storage backends
  • Hive Support - Structured key-value storage with box management
    • TTL-based caching with automatic lazy eviction on read
    • Lazy box initialization
  • SharedPreferences Support - Simple key-value storage
    • TTL-based caching with lazy eviction
    • Configurable key prefix
  • SQLite Support - Relational database operations
    • Raw SQL execution
    • Typed insert/update/delete/query methods
    • Per-table rebuild groups
  • Secure Storage Support - Encrypted storage for sensitive data
    • flutter_secure_storage integration
    • No TTL (by design for security)
  • Background Cleanup - Optional background task for proactive cache eviction
  • Cache Index - Centralized TTL metadata tracking across backends
  • Helper Methods - Convenient async methods on StorageBloc
  • Rebuild Groups - Targeted widget rebuilds per backend/entity
  • Event-Driven Architecture - Full Juice framework integration
  • Cumulative Eviction Tracking - Track evictions by backend type

Documentation #

  • Comprehensive README with badges and examples
  • Complete documentation in doc/ folder:
    • Getting Started guide
    • Storage Backends reference
    • Events Reference
    • Caching and TTL guide
    • Testing guide

Package Publishing #

  • Added LICENSE (MIT)
  • Added pub.flutter-io.cn metadata (topics, funding, issue tracker)
  • Added GitHub Sponsors funding link
1
likes
140
points
234
downloads

Documentation

API reference

Publisher

verified publishernuovea.com

Weekly Downloads

Local storage, caching, and secure storage for the Juice framework. Supports Hive CE, SharedPreferences, SQLite, and flutter_secure_storage.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#storage #cache #hive #sqlite #bloc

Funding

Consider supporting this project:

github.com

License

MIT (license)

Dependencies

flutter, flutter_secure_storage, hive_ce, hive_ce_flutter, juice, path, shared_preferences, sqflite

More

Packages that depend on juice_storage