leulit_flutter_actionmanager 4.1.0 copy "leulit_flutter_actionmanager: ^4.1.0" to clipboard
leulit_flutter_actionmanager: ^4.1.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.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 - Use ActionManager.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 Action class to ActionEvent to avoid naming conflicts with Flutter SDK's built-in Action class
  • This change affects all code that directly instantiates or references the Action class

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 to ActionEvent<T>
  • Updated FullActionHandler<T> typedef to use ActionEvent<T>
  • Updated internal references in ActionManager and ActionLogger
  • Updated all tests (48 tests passing)
  • Updated documentation and examples
  • No analysis issues

Fixed #

  • Eliminated potential naming conflicts with Flutter SDK's Action class
  • Improved clarity and semantic meaning of the action event class

2.0.0 - 2026-02-09 #

🚨 BREAKING CHANGES #

  • Renamed ActionDispatcher to ActionManager to avoid naming conflicts with Flutter's built-in ActionDispatcher class
  • Renamed file action_dispatcher.dart to action_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 ActionDispatcher references updated to ActionManager throughout 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
0
likes
0
points
1.12k
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight, type-safe action dispatcher for Flutter applications. Works seamlessly across all layers - UI, domain, data, and services.

Repository (GitHub)
View/report issues

Topics

#state-management #architecture #events #actions #dispatcher

License

unknown (license)

Dependencies

flutter, meta

More

Packages that depend on leulit_flutter_actionmanager