Skip to content
pubscout

ffi

2.2.0, released 9 months ago by dart.dev

Utilities for working with Foreign Function Interface (FFI) code in Dart.

$ flutter pub add ffi
Source repository

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.

Works with

Packages commonly used together with ffi: ones it builds on, ones built on it, and its own family.