back
loading skill details...
Interoperate with native APIs in a Flutter app on Android, iOS, and the web
Cross-platform native interoperability for Flutter apps on Android, iOS, and Web. Provides decision logic to select the optimal integration strategy: FFI for C/C++ code, Platform Channels for OS-specific APIs, Platform Views for native UI components, and JS Interop for web Implements modern FFI architecture using build hooks (Flutter 3.38+) with native toolchain compilation and Dart bindings Supports asynchronous Platform Channels (MethodChannel) with complete Kotlin and Swift implementations for bidirectional communication Enforces thread safety constraints, WebAssembly compatibility via package:web and dart:js_interop, and platform-specific performance best practices Flutter Platform Integration Goal Integrates Flutter applications with platform-specific code and native features across Android, iOS, and Web environments. Determines the optimal interoperability strategy (FFI, Platform Channels, Platform Views, or JS Interop) and implements the necessary Dart and native code bindings while adhering to thread safety, WebAssembly (Wasm) compatibility, and modern build hook standards. Instructions 1. Determine Integration Strategy (Decision Logic) Evaluate the user's requirements using the following decision tree to select the correct integration path: Scenario A: Calling native C/C++ code. Action: Use dart:ffi with the package_ffi template and build hooks. Exception: If accessing the Flutter Plugin API or requiring static linking on iOS, use the legacy plugin_ffi template. Scenario B: Calling OS-specific APIs (Java/Kotlin for Android, Swift/Obj-C for iOS). Action: Use Platform Channels (MethodChannel) or the pigeon package for type-safe code generation. Scenario C: Embedding native UI components into the Flutter widget tree. Action: Use Platform Views (AndroidView / AndroidViewSurface for Android, UiKitView for iOS). Scenario D: Web integration and JavaScript APIs. Action: Use package:web and dart:js_interop (Wasm-compatible). Use HtmlElementView for embedding web content.
don't have the plugin yet? install it then click "run inline in claude" again.