跪拜 Guibai
← All articles
Frontend · Android · Flutter

With Flutter 3.50, Native Interop Is Stable and Platform Channel Is on Its Way Out

By 恋猫de小郭 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Channel overhead and codec round-trips vanish for the common native-call path, and background isolate calls no longer need the BinaryMessenger dance. The same Pigeon definition keeps Platform Channel alive on Windows and Linux, so the retirement is uneven but the performance on mobile is clear.

Summary

Flutter 3.50 formally stabilizes FFIgen and JNIgen, giving Dart direct foreign-function and JNI access to native APIs. Pigeon now generates FFI/JNI-backed bindings for Android, iOS, and macOS, while Windows and Linux still fall back to Platform Channel. The old message-passing model, with codec round-trips and asynchronous BinaryMessenger hops, is no longer the default path for cross-platform plugin calls.

The new path removes the encoding and dispatch overhead, and it enables synchronous calls from Dart. Background isolates can invoke Pigeon's Host API without jumping through BackgroundIsolateBinaryMessenger or rooting for RootIsolateToken. But calls run on the calling thread, so @TaskQueue is unsupported and a synchronous JNI call from the main isolate can still jank. Native code that touches Android Activity or iOS UIKit must still switch to the platform main thread from a background isolate.

On iOS, FFIgen still can't parse arbitrary Swift; Swift APIs need an Objective-C compatible entry point. Pigeon's generation also lets a single Dart interface produce both FFI/JNI and Platform Channel backends, so a project doesn't need two interface definitions.

Takeaways
— FFIgen's Objective-C bindings and JNIgen's Java/Kotlin bindings are stable in Flutter 3.50.
— Pigeon can generate native-interop bindings from a single Dart interface for Android, iOS, and macOS, falling back to Platform Channel on Windows and Linux.
— Direct FFI/JNI calls eliminate message dispatch and whole-package encoding/decoding, and support synchronous invocation.
— Background isolates can call Pigeon Native Interop Host API directly, without BackgroundIsolateBinaryMessenger or RootIsolateToken.
— Calls execute on the calling thread; @TaskQueue isn't supported, and sync JNI from the main isolate can cause frame jank.
— FFIgen cannot parse arbitrary Swift; Swift APIs must expose an Objective-C compatible header.
— If a project only targets Android system services or C ABI libraries, Pigeon isn't required—Dart can call the platform API directly.
Conclusions

Platform Channel won't disappear overnight; the multi-backend generation keeps it on Windows and Linux, so the retirement is gradual and opt-in per platform.

iOS remains the weak spot: forcing Swift interfaces through Objective-C compatibility stays a friction point, a gap in the "just call native code" story.

The ability to skip Pigeon when wrapping a single Android service or C ABI library signals the interop toolchain is becoming modular codegen, not a one-size-fits-all replacement.

Concepts & terms
FFIgen
A codegen tool that generates Dart bindings from C/Objective-C headers, letting Dart call native functions via FFI.
JNIgen
A codegen tool that generates Dart bindings from Java/Kotlin classes, JARs, or AARs, enabling direct JNI calls.
Pigeon
A codegen tool that takes a Dart interface definition and generates both Dart and native (Swift/Kotlin) code, now able to emit FFI/JNI-based bindings instead of Platform Channel messages.
From the discussion

This thread weighs Platform Channel against the new FFI/JNI interop. Platform Channel is still seen as the more convenient route for iOS and Android device features. The new approach draws a practical concern about threading: with frequent native-level threads, can Dart handle the load? Some also admit they've fallen out of touch with Flutter's latest changes, while Alibaba's toolkit gets a favorable mention.

— Platform Channel is still seen as more convenient for iOS/Android phone features.
— The new FFI/JNI approach must answer how it handles frequent native-level threading, and whether Dart can tolerate that workload.
— A lack of awareness of the new feature exists, with Alibaba's development suite cited as a satisfactory alternative.
Featured comments
伯伯熊勞

For iOS and Android mobile features, it's still more convenient to go through Platform Channel, right?

zhao1zhihui

Using Alibaba's development suite feels pretty good. Is this newly promoted thing something new from Flutter? I haven't paid attention for a long time.

恋猫de小郭

That's roughly it.

终极负能量plus

Previously with platform, the main thing was that multithreading and such could only be done at the native baseline level. If now with this new approach, how do you handle frequent thread operations? Can Dart withstand it?

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗