watchable_redux 1.3.0
watchable_redux: ^1.3.0 copied to clipboard
Predictable state management for Flutter. Redux architecture with O(1) selector caching, memoized selectors, async middleware, and time-travel debugging. Built on Watchable.
Changelog #
All notable changes to the watchable_redux package will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.3.0 - 2025-12-12 #
Added #
Redux.reset()method for proper singleton store cleanup and re-initialization- Auto-memoization for
onlyandwhenparameters inStore.build()(no manual memoization needed) - Comprehensive test suite with 300+ tests covering edge cases, stress tests, and complex scenarios
Changed #
- Renamed
Store.build()parameters:selector→only,shouldRebuild→when - Inlined
DispatcherandGetStatetypedefs intoThunkAction(removed from public API)
Documentation #
- Added
EffectsMiddleware.dispose()documentation for proper cleanup - Updated README with new parameter names (
only:,when:)
1.2.3 - 2025-12-12 #
Documentation #
- Document both
store.build()andstore.select().build()patterns in README - Added
buildmethod to API Reference section
1.2.2 - 2025-12-12 #
Documentation #
- Removed benchmark comparison tables and performance metrics from README
- Retained Performance Tips section for developer guidance
1.2.1 - 2025-12-12 #
Documentation #
- Added
equals: deepEqualsexample to Quick Start section in README
1.2.0 - 2025-12-12 #
Added #
equalsparameter inStoreconstructor for optional deep equality checkingdeepEquals<T>function for comparing collections (useslistEquals,mapEquals,setEquals)StateEquals<S>typedef for equality functions
Performance #
- Equality check runs O(n) once per dispatch (not per-subscriber)
- Default
identical()remains for O(1) performance with immutable patterns
Usage #
// With deep equality (prevents rebuilds for same-content collections)
final store = Store<AppState>(
initialState: AppState.initial(),
reducer: appReducer,
equals: deepEquals, // Built-in deep equality
);
// Without (default - fastest for immutable patterns)
final store = Store<AppState>(
initialState: AppState.initial(),
reducer: appReducer,
);
1.1.0 - 2025-12-12 #
Performance #
- 6x faster state updates with optimized Watchable integration
- Middleware chain now cached at construction time (no per-dispatch allocation)
- Benchmarks show ~10.6M ops/sec with 100 listeners (vs ~1.8M previously)
Changed #
- Updated to use
watchable: ^6.0.0for optimized performance watchableStategetter now returnsWatchable<S>instead ofAbstractWatchable<S>
1.0.1 - 2025-12-04 #
Added #
- Comprehensive dartdoc documentation for all public APIs
- Library-level documentation with usage examples
- Documentation for Store, DevTools, ReduxAction, Reducer, Selector, Middleware, StoreProvider, and Redux
Improved #
- Documentation coverage increased from 1.4% to 23%+ (exceeds pub.flutter-io.cn 20% requirement)
1.0.0 - 2025-12-04 #
Added #
Core Redux Architecture
ReduxAction- Base class for all actions with pattern matching supportReducer<S>- Type-safe state reducers with immutable updatesStore<S>- Centralized state container with O(1) selector cachingcombineReducers- Utility to compose multiple reducers into one
Selectors with Memoization
createSelectorthroughcreateSelector5- Reselect-style memoized selectors- Automatic cache invalidation when input dependencies change
- O(1) selector lookup via internal caching
Middleware System
Middleware<S>- Intercept and transform actions before reducersthunkMiddleware- Async action support with dispatch/getState accessEffectsMiddleware- Stream-based side effects for complex async flowsloggerMiddleware- Debug logging for actions and state changes
Time-Travel DevTools
DevTools<S>- State history recording and navigationundo()/redo()- Step through state historyjumpTo(index)- Jump to any point in historyreset()- Return to initial stateclear()- Clear history while keeping current statemaxHistoryLength- Configurable history size limit
Provider System
StoreProvider<S>- InheritedWidget for store accessReduxsingleton - Global store access patterncontext.store<S>()- Extension for easy store accesscontext.dispatch<S>()- Extension for dispatching actions
Flutter Integration
.build()extension onAbstractWatchablefor reactive UI- O(1) rebuilds with
.map().distinct()optimization - Automatic subscription management
Technical Highlights #
- O(1) Selector Performance - Cached selectors prevent redundant computations
- Minimal Rebuilds - Only affected widgets rebuild on state change
- Type Safety - Full Dart type system support with generics
- Zero Boilerplate - Clean API inspired by modern Redux patterns
- Comprehensive Testing - 120+ tests covering all functionality
Dependencies #
watchable: ^6.0.0- High-performance reactive state primitivesflutterSDK
Quality Assurance #
- 120+ comprehensive test cases
- 100% test success rate
- Zero analyzer warnings
- Full type safety validation