FLUTTER ECOSYSTEM

ffigen

Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files.

Latest version
20.1.1
30-day downloads
807.7K
Likes
332
Pub points
160

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

ffigen is a code generator that creates Dart FFI (Foreign Function Interface) bindings for C, Objective-C, and Swift libraries. It uses LibClang to parse native headers and automatically generates corresponding Dart code, enabling seamless interoperability between Dart and native code. This simplifies calling native functions from Dart without manual binding creation. Ideal for performance-critical applications or integrating existing native libraries into Flutter apps.

Use cases
  • Integrating C libraries into Flutter apps
  • Calling native functions from Dart
  • Generating FFI bindings for iOS and Android
  • Using Swift libraries in Flutter
  • Building high-performance native extensions
Key features
  • Automatically generates FFI bindings
  • Supports C, Objective-C, and Swift
  • Uses LibClang for accurate parsing
  • Generates clean, readable Dart code
  • Configurable output and naming
Suitable for
  • Developers working with native C/C++ libraries
  • Flutter apps needing high-performance native calls
  • Teams maintaining cross-platform native integrations
  • Projects requiring minimal FFI boilerplate
Considerations
  • Requires LibClang installation
  • May need platform-specific configuration
  • Generated code may require manual adjustments
  • Not suitable for dynamic or runtime-loaded libraries
  • Build setup complexity on some platforms
Supported platformsAndroidiOSmacOSWindowsLinux

Install package

flutter pub add ffigen

Categories

Source repository

Related projects