Token导航 LogoToken导航

Agent Skill · 前端设计

flutter-interoperating-with-native-apis(Flutter interoperating with native apis 命令行)

flutter-interoperating-with-native-apis 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

flutter-interoperating-with-native-apis 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 7,512。

总安装 367周安装 15GitHub Stars 公开资料未说明下载 119核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flutter-interoperating-with-native-apis(Flutter interoperating with native apis 命令行)
来源仓库:https://github.com/gsmlg-dev/code-agent
仓库路径:skills/flutter-interoperating-with-native-apis
安装命令:
npx skills add https://github.com/gsmlg-dev/code-agent --skill flutter-interoperating-with-native-apis
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/gsmlg-dev/code-agent --skill flutter-interoperating-with-native-apis

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

该技能用于 Flutter 与原生平台 API 的互操作开发。适用于调用平台特定功能,如相机、传感器或系统服务。支持跨平台宿主环境,便于在混合开发中集成原生能力。

安装命令:npx skills add https://github.com/gsmlg-dev/code-agent --skill flutter-interoperating-with-native-apis。使用前应确认原生模块已正确配置,并注意权限与安全边界。

来源仓库内路径:skills/flutter-interoperating-with-native-apis

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/gsmlg-dev/code-agent --skill flutter-interoper…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

flutter-interoperating-with-native-apis 怎么安装?

在终端执行 npx skills add https://github.com/gsmlg-dev/code-agent --skill flutter-interoperating-with…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

flutter-interoperating-with-native-apis 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

flutter-interoperating-with-native-apis 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

flutter-interoperating-with-native-apis 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

flutter-interoperating-with-native-apis 用的人多吗?

公开数据是累计安装 367 次,近一周安装 15 次,下载 119 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

flutter-interoperating-with-native-apis 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
flutter-interoperating-with-native-apis

Flutter interoperating with native apis 命令行 · 本页

367—操作浏览器未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Integrating Platform-Specific Code in Flutter

Contents

Core Concepts & Terminology

  • FFI (Foreign Function Interface): The dart:ffi library used to bind Dart directly to native C/C++ APIs.
  • Platform Channel: The asynchronous message-passing system (MethodChannel, BasicMessageChannel) connecting the Dart client (UI) to the host platform (Kotlin/Java, Swift/Objective-C, C++).
  • Pigeon: A code-generation tool that creates type-safe Platform Channels.
  • Platform View: A mechanism to embed native UI components (e.g., Android View, iOS UIView) directly into the Flutter widget tree.
  • JS Interop: The modern, Wasm-compatible approach to interacting with JavaScript and DOM APIs using package:web and dart:js_interop.

Binding to Native C/C++ Code (FFI)

Use FFI to execute high-performance native code or utilize existing C/C++ libraries without the overhead of asynchronous Platform Channels.

Project Setup

  • If creating a standard C/C++ integration (Recommended since Flutter 3.38): Use the 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>
  • If requiring access to the Flutter Plugin API or Play Services: Use the legacy plugin_ffi template. flutter create --template=plugin_ffi <plugin_name>

Implementation Rules

  • Symbol Visibility: Always mark C++ symbols with extern "C" and prevent linker discarding during link-time optimization (LTO). extern "C" __attribute__((visibility("default"))) __attribute__((used))
  • Dynamic Library Naming (Apple Platforms): Ensure your 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.
  • Binding Generation: Always use package:ffigen to generate Dart bindings from your C headers (.h). Configure this in ffigen.yaml.

Implementing Platform Channels & Pigeon

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.

Pigeon (Type-Safe Channels)

Always prefer package:pigeon over raw MethodChannel implementations for complex or frequently used APIs.

  1. Define the messaging protocol in a standalone Dart file using Pigeon annotations (@HostApi()).
  2. Generate the host (Kotlin/Swift/C++) and client (Dart) code.
  3. Implement the generated interfaces on the native side.

Threading Rules

  • Main Thread Requirement: Always invoke channel methods destined for Flutter on the platform's main thread (UI thread).
  • Background Execution: If executing channel handlers on a background thread (Android/iOS), you must use the Task Queue API (makeBackgroundTaskQueue()).
  • Isolates: To use plugins/channels from a Dart background Isolate, ensure it is registered using BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken).

Hosting Native Platform Views

Use Platform Views to embed native UI components (e.g., Google Maps, native video players) into the Flutter widget tree.

Android Platform Views

Evaluate the trade-offs between the two rendering modes and select the appropriate one:

  • If requiring perfect fidelity, accessibility, or SurfaceView support: Use Hybrid Composition (PlatformViewLink + AndroidViewSurface). This appends the native view to the hierarchy but may reduce Flutter's rendering performance.
  • If prioritizing Flutter rendering performance and transformations: Use Texture Layer (AndroidView). This renders the native view into a texture. Note: Quick scrolling may drop frames, and SurfaceView is problematic.

iOS Platform Views

  • iOS exclusively uses Hybrid Composition.
  • Implement FlutterPlatformViewFactory and FlutterPlatformView in Swift or Objective-C.
  • Use the UiKitView widget on the Dart side.
  • *Limitation:* ShaderMask and ColorFiltered widgets cannot be applied to iOS Platform Views.

Integrating Web Content & Wasm

Flutter Web supports compiling to WebAssembly (Wasm) for improved performance and multi-threading.

Wasm Compilation

  • Compile to Wasm using: flutter build web --wasm.
  • Server Configuration: To enable multi-threading, configure your HTTP server to emit the following headers:

- Cross-Origin-Embedder-Policy: credentialless (or require-corp) - Cross-Origin-Opener-Policy: same-origin

  • *Limitation:* WasmGC is not currently supported on iOS browsers (WebKit limitation). Flutter will automatically fall back to JavaScript if WasmGC is unavailable.

Web Interop

  • If writing new web-specific code: Strictly use package:web and dart:js_interop.
  • Do NOT use: dart:html, dart:js, or package:js. These are incompatible with Wasm compilation.
  • Embedding HTML: Use HtmlElementView.fromTagName to inject arbitrary HTML elements (like <video>) into the Flutter Web DOM.

Workflows

Workflow: Creating a Native FFI Integration

Use this workflow when binding to a C/C++ library.

  • Task Progress:

- 1. Run flutter create --template=package_ffi <name>. - 2. Place C/C++ source code in the src/ directory. - 3. Ensure all exported C++ functions are wrapped in extern "C" and visibility attributes. - 4. Configure ffigen.yaml to point to your header files. - 5. Run dart run ffigen to generate Dart bindings. - 6. Modify hook/build.dart if linking against pre-compiled or system libraries. - 7. Run validator -> flutter test -> review errors -> fix.

Workflow: Implementing a Type-Safe Platform Channel (Pigeon)

Use this workflow when you need to call Kotlin/Swift APIs from Dart.

  • Task Progress:

- 1. Add pigeon to dev_dependencies. - 2. Create pigeons/messages.dart and define data classes and @HostApi() abstract classes. - 3. Run the Pigeon generator script to output Dart, Kotlin, and Swift files. - 4. Android: Implement the generated interface in MainActivity.kt or your Plugin class. - 5. iOS: Implement the generated protocol in AppDelegate.swift or your Plugin class. - 6. Dart: Import the generated Dart file and call the API methods. - 7. Run validator -> verify cross-platform compilation -> review errors -> fix.

Workflow: Embedding a Native Platform View

Use this workflow when embedding a native UI component (e.g., a native map or camera view).

  • Task Progress:

- 1. Dart: Create a widget that conditionally returns AndroidView (or PlatformViewLink) for Android, and UiKitView for iOS based on defaultTargetPlatform. - 2. Android: Create a class implementing PlatformView that returns the native Android View. - 3. Android: Create a PlatformViewFactory and register it in configureFlutterEngine. - 4. iOS: Create a class implementing FlutterPlatformView that returns the native UIView. - 5. iOS: Create a FlutterPlatformViewFactory and register it in application:didFinishLaunchingWithOptions:. - 6. Run validator -> test on physical Android and iOS devices -> review UI clipping/scrolling issues -> fix.

平台分布

Codex

39.15%
按下载量换算47

Claude

28.7%
按下载量换算34

Cursor

20.11%
按下载量换算24

Gemini CLI

9.08%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills