Repository navigation
[pigeon] Annotate event channel APIs with @MainActor - #13680
vikrant-sainii wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the Pigeon package version to 30.0.4 and introduces @mainactor isolation to generated Swift event-channel APIs and their associated handlers. It also updates the test plugin to use @mainactor for registration and lifecycle methods, and includes a new test case to verify the @mainactor isolation in generated code. The review feedback suggests improving Swift formatting for trailing closures and removing a redundant helper method for checking the main thread, as Thread.isMainThread is directly accessible in asynchronous contexts.
|
Closing as superceded by #13704, thank you for your time and effort making this contribution. |
|
Thanks for the clarification! I understand that #13704 replaces the existing event-channel architecture and supersedes this approach. I appreciate your time reviewing my contribution. I'll follow the progress of the new implementation. |
This PR addresses flutter/flutter#195012.
Pigeon's generated Swift event-channel APIs currently do not explicitly declare their main-actor isolation. Although Flutter invokes event-channel callbacks on the main thread, developers implementing event handlers may need workarounds such as MainActor.assumeIsolated. This PR makes the generated event-channel APIs explicitly main-actor isolated.
Changes:
@MainActor.@MainActor.Testing:
Pre-Review Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2