From flutter-skills
Interoperates with native platform APIs on Android, iOS, and the web. Use when accessing device-specific features not available in Dart or calling existing native code.
npx claudepluginhub gsmlg-dev/code-agent --plugin flutter-skillsThis skill uses the workspace's default tool permissions.
- [Core Concepts & Terminology](#core-concepts--terminology)
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides MCP server integration in Claude Code plugins via .mcp.json or plugin.json configs for stdio, SSE, HTTP types, enabling external services as tools.
dart:ffi library used to bind Dart directly to native C/C++ APIs.MethodChannel, BasicMessageChannel) connecting the Dart client (UI) to the host platform (Kotlin/Java, Swift/Objective-C, C++).View, iOS UIView) directly into the Flutter widget tree.package:web and dart:js_interop.Use FFI to execute high-performance native code or utilize existing C/C++ libraries without the overhead of asynchronous Platform Channels.
package_ffi template. This utilizes build.dart hooks to compile native code, eliminating the need for OS-specific build files (CMake, build.gradle, podspec).
flutter create --template=package_ffi <package_name>
plugin_ffi template.
flutter create --template=plugin_ffi <plugin_name>
extern "C" and prevent linker discarding during link-time optimization (LTO).
extern "C" __attribute__((visibility("default"))) __attribute__((used))
build.dart hook produces the exact same filename across all target architectures (e.g., arm64 vs x86_64) and SDKs (iphoneos vs iphonesimulator). Do not append architecture suffixes to the .dylib or .framework names.package:ffigen to generate Dart bindings from your C headers (.h). Configure this in ffigen.yaml.Use Platform Channels when you need to interact with platform-specific APIs (e.g., Battery, Bluetooth, OS-level services) using the platform's native language.
Always prefer package:pigeon over raw MethodChannel implementations for complex or frequently used APIs.
@HostApi()).makeBackgroundTaskQueue()).Isolate, ensure it is registered using BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken).Use Platform Views to embed native UI components (e.g., Google Maps, native video players) into the Flutter widget tree.
Evaluate the trade-offs between the two rendering modes and select the appropriate one:
PlatformViewLink + AndroidViewSurface). This appends the native view to the hierarchy but may reduce Flutter's rendering performance.AndroidView). This renders the native view into a texture. Note: Quick scrolling may drop frames, and SurfaceView is problematic.FlutterPlatformViewFactory and FlutterPlatformView in Swift or Objective-C.UiKitView widget on the Dart side.ShaderMask and ColorFiltered widgets cannot be applied to iOS Platform Views.Flutter Web supports compiling to WebAssembly (Wasm) for improved performance and multi-threading.
flutter build web --wasm.Cross-Origin-Embedder-Policy: credentialless (or require-corp)Cross-Origin-Opener-Policy: same-originpackage:web and dart:js_interop.dart:html, dart:js, or package:js. These are incompatible with Wasm compilation.HtmlElementView.fromTagName to inject arbitrary HTML elements (like <video>) into the Flutter Web DOM.Use this workflow when binding to a C/C++ library.
flutter create --template=package_ffi <name>.src/ directory.extern "C" and visibility attributes.ffigen.yaml to point to your header files.dart run ffigen to generate Dart bindings.hook/build.dart if linking against pre-compiled or system libraries.flutter test -> review errors -> fix.Use this workflow when you need to call Kotlin/Swift APIs from Dart.
pigeon to dev_dependencies.pigeons/messages.dart and define data classes and @HostApi() abstract classes.MainActivity.kt or your Plugin class.AppDelegate.swift or your Plugin class.Use this workflow when embedding a native UI component (e.g., a native map or camera view).
AndroidView (or PlatformViewLink) for Android, and UiKitView for iOS based on defaultTargetPlatform.PlatformView that returns the native Android View.PlatformViewFactory and register it in configureFlutterEngine.FlutterPlatformView that returns the native UIView.FlutterPlatformViewFactory and register it in application:didFinishLaunchingWithOptions:.