juice 1.1.1
juice: ^1.1.1 copied to clipboard
Juice is an opinionated, team-friendly, modular reactive state management framework for Flutter. It enforces clear boundaries and structured development, combining Clean Architecture-style use cases w [...]
Changelog #
1.1.1 - 2025-01-04 #
1.1.0 - 2025-01-04 #
New Features #
BlocScope Lifecycle Management
- Introduced
BlocScopefor semantic bloc lifecycle control - Added three lifecycle options:
BlocLifecycle.permanent- App-level blocs that live for entire app lifetimeBlocLifecycle.feature- Blocs scoped to a feature, disposed together viaFeatureScopeBlocLifecycle.leased- Widget-level blocs with automatic reference-counted disposal
- Added
BlocLease<T>for safe bloc access with automatic cleanup - Added
BlocScope.diagnostics<T>()for debugging bloc state - Added
BlocScope.debugDump()for development diagnostics
Cross-Bloc Communication
- Added
EventSubscriptionfor listening to events from one bloc and forwarding to another - Added
StateRelayfor simple state-to-event transformation between blocs - Added
StatusRelayfor full StreamStatus access when reacting to state changes - Added
whenpredicate filtering for both event subscriptions and relays
Deprecated #
RelayUseCaseBuilderis now deprecated in favor ofStateRelayandStatusRelayStateRelay- Use when you only need to react to state changes (most common)StatusRelay- Use when you need to handle waiting/error states- Will be removed in v2.0.0
Bug Fixes #
- Fixed race condition in
EventSubscriptioninitialization whenclose()called before microtask executes - Fixed race condition in
RelayUseCaseBuilderinitialization - Fixed unsafe dynamic cast in
UseCaseExecutor- replaced with type-safesetBloc()method - Fixed forced non-null access in
widget_support.dartwith safe null-coalescing - Fixed inconsistent default groups in
StatelessJuiceWidget2(now uses{"*"}like other variants)
Improvements #
- Added bloc type context to relay error messages for better debugging
- Added warning log when
EventDispatcheruses unhandled event fallback - Simplified verbose error throwing patterns in
JuiceAsyncBuilderwith helper getters - Removed ambiguous
_Disposableinterface fromJuiceBloc, documenteddispose()method - Added event type to state emission logs for improved observability
Tests #
- Added comprehensive test suite for
BlocScopelifecycle management (20 tests) - Added
EventSubscriptiontests covering transformation, filtering, and race conditions (10 tests) - Added
RelayUseCaseBuildertests covering relay, error handling, and multi-relay scenarios (10 tests) - Added
StateRelayandStatusRelaytests (13 tests) - Added resource cleanup tests for bloc close, stream cleanup, and lease disposal (9 tests)
- Total: 62 new tests, 93 tests overall
Documentation #
- Updated README to use
BlocScopeinstead ofGlobalBlocResolver - Added comprehensive documentation for lifecycle management
- Added cross-bloc communication examples
- Updated Best Practices with lifecycle and communication guidelines
Migration Guide #
GlobalBlocResolver is still available for backwards compatibility, but BlocScope is now the recommended approach:
// Before (still works)
GlobalBlocResolver().resolver = BlocResolver();
// After (recommended)
BlocScope.register<MyBloc>(
() => MyBloc(),
lifecycle: BlocLifecycle.permanent,
);
1.0.4 - 2025-02-08 #
1.0.3 - 2025-02-07 #
1.0.2 - 2025-01-30 #
Documentation #
- Updated
README.mdwith various improvements. - Improved package documentation for better clarity.
- Removed misleading
copyWithmention in comments withinbloc_state.dart. - Properly escaped angle brackets in dartdoc comments
Community & Support #
- Added initial setup for
FUNDING.yamlto support sponsorship options.
Maintenance #
- Version bump in
pubspec.yamlto1.0.2.
1.0.1 - 2025-01-23 #
Enhancements #
- Added
StatusChecksextension forStreamStatus:- Includes methods for type-checking (
isUpdatingFor,isWaitingFor, etc.). - Added safe casting methods (
tryCastToUpdating,tryCastToWaiting, etc.). - Introduced a
matchmethod for pattern-matching onStreamStatustypes. - Simplified handling of
StreamStatusacross widgets and logic.
- Includes methods for type-checking (
Developer Experience #
- Improved type safety and reduced boilerplate for handling transient states.
- Enhanced readability and maintainability of
StreamStatususage.
1.0.0 - 2025-01-16 #
Core Features #
- Introduced JuiceBloc with use case-driven state management
- Implemented StreamStatus
- Added group-based widget rebuilding system for performance optimization
- Created StatelessJuiceWidget for reactive UI updates
Use Case System #
- Introduced BlocUseCase for structured business logic
- Added StatefulUseCaseBuilder for singleton use cases
- Implemented RelayUseCaseBuilder for bloc-to-bloc communication
- Added UpdateUseCase for quick state updates
Navigation #
- Implemented Aviator system for declarative navigation
- Added DeepLinkAviator for handling deep linking
- Created base AviatorBase class for custom navigation handlers
Dependency Resolution #
- Added BlocDependencyResolver interface
- Implemented GlobalBlocResolver for centralized bloc management
- Created CompositeResolver for flexible dependency injection
Widgets #
- StatelessJuiceWidget and JuiceWidgetState for single bloc binding
- StatelessJuiceWidget2 and StatelessJuiceWidget3 for multiple bloc bindings
- Added JuiceAsyncBuilder for stream handling
Logging & Error Handling #
- Implemented JuiceLogger interface
- Added DefaultJuiceLogger with configurable options
- Created structured error handling system
Developer Experience #
- Added comprehensive code documentation
- Implemented type-safe APIs throughout
- Created builder patterns for common operations
Initial Contributors #
- Kevin Ehmka
Note: This is the first stable release of Juice, a state management solution designed to provide a clean architecture plus bloc approach to Flutter applications.