flutter-interoperating-with-native-apis

Integrates Flutter apps with native Android, iOS, and web platform APIs.

1|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/Wishtohear/bucket-water-oms --skill flutter-interoperating-with-native-apis-wishtohear
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flutter-interoperating-with-native-apis
Source: https://github.com/Wishtohear/bucket-water-oms/tree/main/bucket-water-oms-admin-mobile/skills/flutter-interoperating-with-native-apis
Command: npx skills add https://github.com/Wishtohear/bucket-water-oms --skill flutter-interoperating-with-native-apis-wishtohear

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pigeon, ffigen, package:web.

What problem does it solve? Flutter apps often need device features or existing native code that Dart cannot access directly, such as C/C++ libraries, OS-level services, or native UI components. This Skill provides the patterns and rules for bridging Dart with native platforms correctly. ## Core Features & Use Cases - FFI Bindings: Bind Dart to C/C++ libraries using dart:ffi, the package_ffi template, and ffigen-generated bindings. - Type-Safe Platform Channels: Implement Pigeon-generated MethodChannel APIs for calling Kotlin, Swift, and C++ host code with correct threading rules. - Native Platform Views & Web Interop: Embed Android Views and iOS UIViews into the widget tree, and write Wasm-compatible web code using package:web and dart:js_interop. - Use Case: You need to display a native Google Maps view and call a platform battery API in your Flutter app. Follow the Platform View workflow to embed the map and the Pigeon workflow to create a type-safe channel for the battery call. ## Quick Start Ask the assistant to implement a type-safe platform channel with Pigeon so your Flutter app can call a native Android or iOS API.

Frequently Asked Questions about flutter-interoperating-with-native-apis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I call native code from Flutter?▼

Use platform channels (MethodChannel or Pigeon) to call Kotlin, Swift, or C++ host code asynchronously, or use dart:ffi to bind directly to C/C++ libraries. Pigeon is preferred for complex APIs because it generates type-safe code for both sides.

What is the difference between FFI and platform channels in Flutter?▼

FFI binds Dart synchronously to C/C++ functions with low overhead, ideal for performance-critical native libraries. Platform channels are asynchronous message-passing to the host platform, suited for OS APIs like battery or Bluetooth.

How do I embed a native Android or iOS view in Flutter?▼

Use AndroidView or PlatformViewLink on Android and UiKitView on iOS, backed by a registered PlatformViewFactory. On Android, choose hybrid composition for fidelity and SurfaceView support, or texture layer for better Flutter rendering performance.

Does Flutter web support dart:html with Wasm compilation?▼

No. dart:html, dart:js, and package:js are incompatible with Wasm compilation. New web code must use package:web and dart:js_interop, and HTML elements can be embedded with HtmlElementView.fromTagName.

Why does my platform channel fail from a background isolate?▼

Plugins and channels used from a Dart background isolate require registering the isolate with BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken). Channel handlers on background native threads also need the Task Queue API.