搜尋套件、儲存庫與 APP 分類

套件詳情v23.0.0

ffigen

使用 LibClang 解析 C、Objective-C 和 Swift 檔案的 FFI 繫結產生器。

AndroidiOSmacOSWindowsLinux
近 30 天下載
109萬
喜歡數
338
Pub 分數
160

安裝套件

flutter pub add ffigen

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

ffigen 是一個程式碼產生器,可為 C、Objective-C 和 Swift 庫產生 Dart FFI(外部函數介面)綁定。它使用 LibClang 解析原生標頭檔,並自動產生對應的 Dart 程式碼,以實現 Dart 與原生程式碼之間的無縫互通。這簡化了從 Dart 呼叫原生函數的過程,無需手動建立綁定。適用於對效能有嚴格要求的應用,或將現有的原生庫整合至 Flutter 應用中。

適用情境

  • 將C庫整合到Flutter應用中
  • 從 Dart 呼叫原生函數
  • 為 iOS 和 Android 生成 FFI 繫結
  • 在 Flutter 中使用 Swift 庫
  • 建構高性能原生擴展

主要特色

  • 自動生成 FFI 綁定
  • 支援 C、Objective-C 與 Swift
  • 使用 LibClang 進行精確解析
  • 產生乾淨、易讀的 Dart 程式碼
  • 可設定的輸出與命名

適合對象

  • 使用原生 C/C++ 庫的開發人員
  • 需要高性能量化呼叫的Flutter應用
  • 維護跨平台原生整合的團隊
  • 需要最少 FFI 雜項的專案

使用建議

  • 需要安裝 LibClang
  • 可能需要平台特定的設定
  • 產生的程式碼可能需要手動調整
  • 不適用於動態或執行時載入的函式庫
  • 某些平台上的建構設定複雜度

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Coverage Status

Overview

This repository is home to Dart packages related to FFI and native assets building and bundling.

Documentation

See the doc directory for more documentation.

Packages

Package Description Issues Version
code_assets This package contains the Dart API for code assets in hook/build.dart and hook/link.dart. issues pub package
data_assets This package contains the Dart API for data assets in hook/build.dart and hook/link.dart. issues pub package
ffi Utilities for working with Foreign Function Interface (FFI) code. issues pub package
ffigen Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. issues pub package
hooks This package contains the API for hook/build.dart and hook/link.dart. issues pub package
hooks_runner This package is the backend that invokes hook/build.dart and hook/link.dart from Dart and Flutter. issues pub package
jni A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen. issues pub package
jni_flutter A library to access Flutter Android specific APIs from Dart. issues pub package
jni_util A library to access Flutter Android specific APIs from Dart. issues pub package
jnigen A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. issues pub package
native_toolchain_c A library to invoke the native C compiler installed on the host machine. issues pub package
objective_c A library to access Objective C from Flutter that acts as a support library for package:ffigen. issues pub package
record_use Dart API to access @RecordUse() recorded usages in link hooks. issues pub package
swift2objc A tool for generating bindings that allow interop between Dart and Swift code. issues pub package
swiftgen A tool for generating bindings that allow interop between Dart and Swift code. issues pub package

External packages

Packages not on this repo but also related to FFI and native assets. ❤️

Package Description Version
native_toolchain_cmake A library to invoke CMake for Dart Native Assets. pub package
native_toolchain_go A library to invoke the native Go compiler installed on the host machine. pub package
native_toolchain_ninja A library to invoke Ninja for Dart Native Assets. pub package
native_toolchain_rust A library to build and bundle Rust code for Dart Native Assets. pub package
native_toolchain_zig A library to build and bundle Zig code for Dart Native Assets. pub package

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

For additional information about contributing, see our contributing page.

所屬分類

依賴

依賴清單 18 項

原始碼儲存庫

使用此套件的專案

所在榜單