Skip to content

[pigeon] add modern concurrency support - #12382

Merged
auto-submit[bot] merged 14 commits into
flutter:mainfrom
tarrinneal:swift-async-kotlin-suspend
Aug 21, 2026
Merged

auto-submit[bot] merged 14 commits into
flutter:mainfrom
tarrinneal:swift-async-kotlin-suspend

Conversation

@tarrinneal

@tarrinneal tarrinneal commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Adds support for modern async method styles in swift and kotlin. This is now the default. Also adds a new annotation AsyncCallback that reverts to the old style.

precursor to #11352
work towards flutter/flutter#182230

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Pigeon generator to produce native asynchronous signatures (suspend in Kotlin and async throws in Swift) by default for @FlutterApi and @HostApi methods, while introducing a new @asyncCallback annotation to retain callback-style signatures. Feedback on the changes identifies a thread-safety issue in the Swift generator where spawning a Task without isolation can cause the reply callback to execute on a background thread, and suggests isolating the Task to @MainActor when no background queue is specified.

Comment thread packages/pigeon/lib/src/swift/swift_generator.dart Outdated

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good at a high level, with the caveat that I have very little experience with the modern concurrency syntax (although certainly the ergonomics in the test plugin look way better). It might be worth making a draft PR that adopts it in one of our plugins and getting a review from Android and iOS folks so they can flag anything that looks unexpected in real use, especially since we are making this the default. (To avoid pulling the entire diff into that PR, you can use a git dependency that points to this branch).

This will also need README updates, both explaining the two modes, and also explaining that only some generators distinguish, and explaining what happens when it's not supported (which IIUC is that the two annotations do the same thing).

Comment thread packages/pigeon/pigeons/core_tests.dart

@stuartmorgan-g stuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'll leave it up to you if you want to get a draft adoption PR reviewed by platform team folks before landing, or just want to iterate in future PRs if any issues come up that the tests missed.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 20, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 20, 2026
@auto-submit

auto-submit Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12382, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 20, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 20, 2026
@auto-submit

auto-submit Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/12382, because - The status or check suite Dashboard Checks has failed. Please fix the issues identified (or deflake) before re-applying this label.

@tarrinneal tarrinneal added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 21, 2026
@auto-submit
auto-submit Bot merged commit 6bb3423 into flutter:main Aug 21, 2026
13 checks passed
pull Bot pushed a commit to fucheng-guo-sun/flutter that referenced this pull request Aug 24, 2026
…r#191578)

flutter/packages@252bb33...df2ba94

2026-08-24 49699333+dependabot[bot]@users.noreply.github.com
[dependabot]: Bump org.json:json from 20260719 to 20260814 in
/packages/in_app_purchase/in_app_purchase_android/example/android/app
(flutter/packages#12570)
2026-08-22 [email protected] Roll Flutter from
c243752 to 65c9a8d (195 revisions) (flutter/packages#12554)
2026-08-21 [email protected] [pigeon] add modern concurrency support
(flutter/packages#12382)
2026-08-21 [email protected]
[material_ui] Remove no-shuffle in scrollbar test
(flutter/packages#12527)
2026-08-21 [email protected]
[material_ui] Remove no-shuffle from dropdown test
(flutter/packages#12528)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants