ffi
2.2.0, released 9 months ago by dart.dev
Utilities for working with Foreign Function Interface (FFI) code in Dart.
What it does
Provides utility functions and classes for working with Foreign Function Interface (FFI) code. It includes capabilities for converting between Dart strings and C strings encoded with UTF-8 and UTF-16.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to interoperate with C libraries from Dart
- You need to handle UTF-8 and UTF-16 string conversions for C interop
Skip it when
- You are writing pure Dart code without native C integration
Strengths
- Official utility package for Dart FFI string and memory handling
- Simplifies conversion between Dart strings and C strings
Weaknesses
- Requires understanding of native memory management and FFI concepts
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Not documented
import 'package:ffi/ffi.dart';
// Allocate and free native memory or convert strings using package utilities.Alternatives
Packages that do the same job and could replace ffi.
- async
Utility classes and helpers that extend Dart's async library.
83Compare - flutter_flavorizr
A utility to easily create and configure application flavors in Flutter.
86Compare - native_stack_traces
Decode non-symbolic stack traces from AOT-compiled Dart apps using stored debugging info
83Compare - black_hole_flutter
Flutter utility functions, extension methods, and custom widgets.
83Compare
Works with
Packages commonly used together with ffi: ones it builds on, ones built on it, and its own family.
- win32Built on ffiCall common Windows APIs and COM objects directly from Dart using FFI.
- cli_utilBuilt on ffiUtilities to help build Dart command-line apps, find the SDK, and display progress.
- jniBuilt on ffiProvides Dart/Flutter bindings to call native Java code via JNI.
- path_provider_windowsBuilt on ffiWindows implementation of the path_provider plugin
- path_provider_foundationBuilt on ffiiOS/macOS implementation of path_provider using direct FFI calls
- posixBuilt on ffiExposes the POSIX api on OSx and Linux via an idiomatic Dart API.
- objective_cBuilt on ffiSupport library for accessing Objective C via ffigen in Flutter
- dbusBuilt on ffiNative Dart D-Bus client for Linux and Windows.