leulit_flutter_actionmanager 4.2.0
leulit_flutter_actionmanager: ^4.2.0 copied to clipboard
A lightweight, type-safe action dispatcher for Flutter applications. Works seamlessly across all layers - UI, domain, data, and services.
Changelog #
4.2.0 - 2026-02-10 #
🚨 BREAKING CHANGES #
- ActionManagerWidget builder signature changed - Now requires 3 parameters:
(BuildContext context, T? data, Enum action)instead of 2- Migration: Add the
actionparameter to your builder function - Before:
builder: (context, data) => Text('$data') - After:
builder: (context, data, action) => Text('$data')
- Migration: Add the
✨ New Features #
- Added action parameter to ActionManagerWidget builder - Now you can access the action being dispatched for debugging purposes
- Better debugging capabilities - Use the action parameter to log which action triggered the rebuild
🐛 Bug Fixes #
- Fixed excessive rebuilds in
ActionManagerWidget- Widget now only rebuilds when data actually changes, not on every dispatch - Fixed excessive rebuilds in
ActionManagerMultiWidget- Widget now only rebuilds when event data changes, not on every dispatch
Improved #
- Performance optimization - Added equality check before calling
setState()to prevent unnecessary rebuilds - Better efficiency - Widgets are more performant when multiple dispatches occur with the same data
- Enhanced developer experience - Action parameter helps identify which action triggered a rebuild
Example #
ActionManagerWidget<bool>(
action: AppAction.displayForm,
builder: (context, display, action) {
debugPrint('Action: $action'); // For debugging
if (display == true) return MyForm();
return const SizedBox.shrink();
},
)
4.1.0 - 2026-02-10 #
✨ New Features #
- Added
ActionManagerWidget<T>- Reactive widget that automatically rebuilds when a specific action is dispatched - Added
ActionManagerMultiWidget- Reactive widget that rebuilds when any of multiple actions is dispatched
Features #
ActionManagerWidget
A stateful widget that:
- Automatically subscribes to an action on
initState - Calls
setState()when the action is dispatched - Auto-cancels subscription on
dispose - Supports optional placeholder before first event
- Type-safe with generic data type
Example:
ActionManagerWidget<User>(
action: AppAction.userUpdated,
placeholder: CircularProgressIndicator(),
builder: (context, user) {
return Text('User: ${user?.name ?? "none"}');
},
)
ActionManagerMultiWidget
Listens to multiple actions and provides the full ActionEvent:
ActionManagerMultiWidget(
actions: [AppAction.userUpdated, AppAction.userLoggedIn],
builder: (context, event) {
return Text('Last action: ${event?.action.name}');
},
)
Added #
- New file:
lib/src/action_manager_widget.dart - 10 new widget tests (64 total tests passing)
- Exported widgets in main library file
Improved #
- Simplified reactive UI patterns - no need for manual StreamSubscription management
- Better separation of concerns - widgets handle their own lifecycle
4.0.0 - 2026-02-10 #
🚨 BREAKING CHANGES #
- Removed
streamOf<T>()method - UseActionManager.stream.where((a) => a.action == yourAction)instead for filtering streams by action
✨ Improvements #
- Simplified dispatch logic - Removed internal complexity while maintaining all functionality
- More predictable stream behavior - Stream always emits events even without registered handlers
- Better code maintainability - Cleaner, more straightforward implementation
Migration Guide #
If you were using streamOf<T>():
Before:
final subscription = ActionManager.streamOf<String>(AppAction.test)
.listen((action) {
print(action.data);
});
After:
final subscription = ActionManager.stream
.where((a) => a.action == AppAction.test)
.listen((action) {
print(action.data as String?);
});
Or simply use the higher-level listen() API:
final subscription = ActionManager.listen<String>(
AppAction.test,
(data) => print(data),
);
3.0.0 - 2026-02-09 #
🚨 BREAKING CHANGES #
- Renamed
Actionclass toActionEventto avoid naming conflicts with Flutter SDK's built-inActionclass - This change affects all code that directly instantiates or references the
Actionclass
Why This Change? #
The Flutter SDK includes a built-in Action class in package:flutter/src/widgets/actions.dart. Using a class with the same name in this package could cause naming conflicts and ambiguity in applications that use both Flutter's actions system and this action manager.
Migration Guide #
The ActionManager API remains unchanged. If you were only using the high-level API (ActionManager.dispatch, ActionManager.on, etc.), no changes are needed.
If you were directly instantiating or type-checking against the Action class:
Before:
final action = Action<String>.now(AppAction.test, data: 'test');
if (myVar is Action<String>) { ... }
After:
final action = ActionEvent<String>.now(AppAction.test, data: 'test');
if (myVar is ActionEvent<String>) { ... }
Changed #
- Renamed
Action<T>class toActionEvent<T> - Updated
FullActionHandler<T>typedef to useActionEvent<T> - Updated internal references in
ActionManagerandActionLogger - Updated all tests (48 tests passing)
- Updated documentation and examples
- No analysis issues
Fixed #
- Eliminated potential naming conflicts with Flutter SDK's
Actionclass - Improved clarity and semantic meaning of the action event class
2.0.0 - 2026-02-09 #
🚨 BREAKING CHANGES #
- Renamed
ActionDispatchertoActionManagerto avoid naming conflicts with Flutter's built-inActionDispatcherclass - Renamed file
action_dispatcher.darttoaction_manager.dart
Migration Guide #
Simply replace all instances of ActionDispatcher with ActionManager in your code:
Before:
ActionDispatcher.dispatch(AppAction.test);
ActionDispatcher.on<String>(AppAction.test, (data) {});
After:
ActionManager.dispatch(AppAction.test);
ActionManager.on<String>(AppAction.test, (data) {});
Changed #
- All
ActionDispatcherreferences updated toActionManagerthroughout the library - Updated all documentation (README.md, project.md)
- Updated all examples and tests
- All 48 tests passing
- No analysis issues
1.0.2 - 2026-02-09 #
Added #
- Comprehensive test suite with 48 tests covering all library methods
- Tests for Action class (creation, equality, hashCode, toString)
- Tests for ActionDispatcher dispatch, registration, and unregistration
- Tests for reactive streams (listen, stream, streamOf)
- Tests for metadata and statistics tracking
- Tests for error handling and resilience
- Tests for ActionLogger configuration
- Integration tests for complex workflows
Improved #
- Enhanced code formatting across all files
- Better test coverage and reliability
- Improved documentation in test files
1.0.0 - 2026-02-09 #
Added #
- Initial release
- Core ActionDispatcher with enum-based actions
- Type-safe action handlers
- Built-in debugging and introspection
- Reactive StreamSubscription support
- Comprehensive documentation and examples
- Unit tests with full coverage
- Example application demonstrating key features