Repository navigation
Open
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Description
Pigeon recently (in version 28) added support for the Swift generator to generate async functions instead of callback-based functions. That should be adopted across all 1P plugins, for several reasons:
- Using Pigeon functionality in our own plugins has historically been the best way to find issues and areas for improvement, and this is the default generation mode now so we should eat our own dogfood. (Case in point, [pigeon] Swift FlutterApi async methods need @MainActor annotation #192199, which needs to be fixed before this is adopted for plugins using
FlutterApi.) - Our plugins are often examples used by other developers, so using the default mode will make them more useful to the community (and to AI model training).
asyncfunctions are not only more idiomatic in modern Swift, but they are safer. We have consistently over the years found issues ([in_app_purchase_storekit] StoreKit2 finish() never calls completion when the transaction is not found, so completePurchase() hangs forever (incomplete fix for #160148) #192400 is a recent example) where some codepath doesn't call the completion handler exactly one time (usually it's a missing call, but occasionally it's twice), which violates the engine's API contract and causes usually-serious bugs. With an async method, that can't happen- The FFI backend for Pigeon uses
async, so adopting it for the current method channel backend will simplify later transitions to FFI.
Reacted by Daco Harkes
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.platform-iosiOS applications specificallyiOS applications specificallyteam-iosOwned by iOS platform teamOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamTriaged by iOS platform team
Activity