Repository navigation
Add Native interop documentation section (Pigeon, FFIgen, JNIgen, dart:ffi) - #13995
Conversation
- Add Native interop landing page with decision tree and layers guide - Add Pigeon guide covering platform channels and native bindings modes - Add FFIgen guide covering Apple frameworks, C-ABI, and developer flow - Add dart:ffi guide for native memory allocation and concurrency - Move bind-native-code into platform-integration/interop/ - Add JNIgen guide for Java/Kotlin and Android bindings - Update platform-channels to focus on manual message passing - Update sidenav default.yml with new Native interop section - Update firebase.json with 301 redirect for bind-native-code TAG=agy CONV=a76ca369-bcbf-4f8a-822b-b2d6bdd86f54
- Restore exact text, structure, and headings from the Google Doc - Remove extraneous code examples from developer flow sections TAG=agy CONV=a76ca369-bcbf-4f8a-822b-b2d6bdd86f54
|
Staged preview of the updated docs.flutter.dev site (updated for commit fcf3a7e): |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive "Native interop" documentation section, adding new guides for dart:ffi, FFIgen, JNIgen, and Pigeon, along with an overview page to help developers choose the right interop solution. It also updates existing platform integration docs, sidebar navigation, and redirects to point to these new pages. A review comment points out an incorrect API reference in the JNIgen guide, suggesting the use of PlatformDispatcher.instance.scheduleOnPlatformThread instead of runOnPlatformThread.
sfshaza2
left a comment
There was a problem hiding this comment.
I have some quibbles but, overall, a great addition to the site! I like the decision graph and would be hesitant to clobber it. I also like the table comparing the approaches.
sfshaza2
left a comment
There was a problem hiding this comment.
lgtm, once my feedback is incorporated. I'll go ahead and approve, but I'd like approval from a SME. thx! Overall, this looks great!
tarrinneal
left a comment
There was a problem hiding this comment.
Just a couple little clarifications
There was a problem hiding this comment.
Code Review
This pull request restructures the documentation by introducing a new 'Native interop' section, adding dedicated guides for dart:ffi, FFIgen, JNIgen, and Pigeon, and updating existing files to link to these new paths. Feedback on these changes includes a suggestion to flatten the sidebar navigation under 'Native interop' to make dart:ffi and 'Bind to native code' more discoverable, as well as a correction in the FFIgen guide to use .cast<T>() instead of .as() for casting Objective-C objects to avoid compilation errors.
mariamhas
left a comment
There was a problem hiding this comment.
Left some comments that need to be addressed before this is published
goderbauer
left a comment
There was a problem hiding this comment.
There's still outdated verbiage in one places on the website, e.g.
https://docs.flutter.dev/platform-integration/android/call-jetpack-apis says:
In the coming months, the Dart team hopes to make this process easier with direct support for calling native APIs using the FFI approach...
Can we update that as well as part of this update?
|
@goderbauer Thanks for spotting the outdated verbiage. I made that change, and did a scan to update a few more outdated instances. |
| and enables native memory interop. | ||
|
|
||
| ## When to use `dart:ffi` | ||
| ## When to use `dart:ffi` and `package:ffi` |
There was a problem hiding this comment.
I wonder if we need this section at all now? It's a bit redundant with the "## Core tools: dart:ffi and package:ffi" section below, and that section is much clearer.
Description of what this PR is changing or adding, and why:
Adds the new top-level Native interop documentation section (
/interop) for the upcoming Flutter 3.50 / Native Interop GA release:/interop): Decision tree (Mermaid flowchart and step-by-step walkthrough), packaging options, tool comparison matrix, and 3-layer interop architecture./interop/pigeon): Covers Pigeon with native interop (direct FFI on iOS/macOS and JNI on Android) and Pigeon with platform channels, developer workflow, examples, and constraints./interop/ffigen): Covers generating C, Objective-C, and Swift bindings withtool/ffigen.dart, developer workflow, examples, and platform/runtime considerations./interop/jnigen): Covers generating Java and Kotlin bindings on Android withtool/jnigen.dart, developer workflow, examples, and threading/reference lifecycle considerations.dart:ffi(/interop/dart-ffi): Covers native memory allocation, data conversion (package:ffi), and isolate concurrency (Isolate.run)./interop/bind-native-code): Moved from/platform-integration/bind-native-codewith a 301 redirect infirebase.json./platform-integration/platform-channels): Updated to link to the new Native interop overview and dedicated Pigeon guide.sites/docs/src/data/sidenav/default.yml): Adds the top-level Native interop section above Platform integration.Issues fixed by this PR (if any):
PRs or commits this PR depends on (if any):
N/A (Draft for early review and staging preview before Flutter 3.50 release)
Presubmit checklist
of 80 characters or fewer.