Merged
Conversation
…ed logic from Controller
…ing and improve synchronization logic
… is updated correctly
…mproved readability
- Introduced Mutex-based synchronization in SequentialControllerHandler to ensure sequential execution of operations. - Removed the custom event queue implementation, simplifying the concurrency model. - Updated Controller class to track processing calls and provide a clearer isProcessing state. - Enhanced error handling and completion tracking in the handle method of Controller. - Updated tests to reflect changes in concurrency behavior and ensure proper functionality across sequential, droppable, and concurrent controllers.
…concurrency strategies, update documentation, and adjust migration guides accordingly
There was a problem hiding this comment.
Pull request overview
This pull request introduces a major architectural refactor for version 1.0.0-dev.1, simplifying concurrency handling in the Control state management library. The changes focus on making the library more flexible and easier to use by removing restrictive modifiers and providing a default concurrent implementation in the base Controller class.
Changes:
- Removed
basemodifiers fromController,StateController, and concurrency handler mixins for more flexibility - Added default concurrent
handle()implementation with generic return values (Future<T?>) - Simplified concurrency handler mixins to use
Mutexinternally (reduced from ~300 to ~90 lines) - Introduced
Mutexas a core primitive for custom concurrency control - Deprecated
ConcurrentControllerHandler(now redundant) - Updated dependencies and added comprehensive documentation (README, MIGRATION.md, IDEAS.md)
Reviewed changes
Copilot reviewed 41 out of 45 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/src/controller.dart | Added default concurrent handle() implementation with generic return values, error/done callbacks, and zone-based error catching |
| lib/src/mutex.dart | New public API for Mutex synchronization primitive |
| lib/src/util/linked_mutex.dart | Linked-list based Mutex implementation using completers |
| lib/src/concurrency/*.dart | Simplified mixins to wrap super.handle() with Mutex |
| lib/src/state_controller.dart | Minor formatting and removed base modifier |
| lib/src/registry.dart | Removed (no longer needed) |
| test/unit/mutex_test.dart | Comprehensive new test suite (1137 lines) |
| test/unit/state_controller_test.dart | Added tests for generic handle and updated for new behavior |
| pubspec.yaml | Version bump and dependency updates |
| example/lib/main.dart | Updated to demonstrate new API with callbacks and return values |
| README.md | Extensive documentation improvements with examples |
| MIGRATION.md | Comprehensive migration guide from 0.x to 1.0.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.