dart:ffi library Null safety

Foreign Function Interface for interoperability with the C programming language.

For further details, please see: https://dart.cn/server/c-interop.

Classes

Abi
An application binary interface (ABI).
AbiSpecificInteger
The supertype of all Abi-specific integer types.
AbiSpecificIntegerMapping
Mapping for a subtype of AbiSpecificInteger.
Allocator
Manages memory on the native heap.
Array<T extends NativeType>
A fixed-sized array of Ts.
Bool
Represents a native bool in C.
Char
The C char type.
Dart_CObject
Opaque, not exposing it's members.
DartRepresentationOf
Double
Represents a native 64 bit double in C.
DynamicLibrary
A dynamically loaded native library.
FfiNative<T>
Annotation to be used for marking an external function as FFI native.
Finalizable
Marker interface for objects which should not be finalized too soon.
Float
Represents a native 32 bit float in C.
Handle
Represents Dart_Handle in C.
Int
The C int type.
Int16
Represents a native signed 16 bit integer in C.
Int32
Represents a native signed 32 bit integer in C.
Int64
Represents a native signed 64 bit integer in C.
Int8
Represents a native signed 8 bit integer in C.
IntPtr
The C intptr_t type.
Long
The C long int, aka. long, type.
LongLong
The C long long type.
NativeApi
Utilities for accessing the Dart VM API from Dart code or from C code via dart_api_dl.h.
NativeFinalizer
A native finalizer which can be attached to Dart objects.
NativeFunction<T extends Function>
Represents a function type in C.
NativeType
NativeType's subtypes represent a native type in C.
Opaque
Opaque's subtypes represent opaque types in C.
Packed
Annotation to specify on Struct subtypes to indicate that its members need to be packed.
Pointer<T extends NativeType>
Represents a pointer into the native C memory. Cannot be extended.
Short
The C short type.
SignedChar
The C signed char type.
Size
The C size_t type.
Struct
The supertype of all FFI struct types.
Uint16
Represents a native unsigned 16 bit integer in C.
Uint32
Represents a native unsigned 32 bit integer in C.
Uint64
Represents a native unsigned 64 bit integer in C.
Uint8
Represents a native unsigned 8 bit integer in C.
UintPtr
The C uintptr_t type.
Union
The supertype of all FFI union types.
UnsignedChar
The C unsigned char type.
UnsignedInt
The C unsigned int type.
UnsignedLong
The C unsigned long int, aka. unsigned long, type.
UnsignedLongLong
The C unsigned long long type.
UnsignedShort
The C unsigned short type.
Unsized
Void
Represents a void type in C.
WChar
The C wchar_t type.

Extensions

AbiSpecificIntegerArray
Bounds checking indexing methods on Arrays of AbiSpecificInteger.
AbiSpecificIntegerPointer
Extension on Pointer specialized for the type argument AbiSpecificInteger.
AllocatorAlloc
Extension on Allocator to provide allocation with NativeType.
ArrayArray
Bounds checking indexing methods on Arrays of Array.
BoolArray
Bounds checking indexing methods on Arrays of Bool.
BoolPointer
Extension on Pointer specialized for the type argument Bool.
DoubleArray
Bounds checking indexing methods on Arrays of Double.
DoublePointer
Extension on Pointer specialized for the type argument Double.
DynamicLibraryExtension
Method which must not be invoked dynamically.
FloatArray
Bounds checking indexing methods on Arrays of Float.
FloatPointer
Extension on Pointer specialized for the type argument Float.
Int16Array
Bounds checking indexing methods on Arrays of Int16.
Int16Pointer
Extension on Pointer specialized for the type argument Int16.
Int32Array
Bounds checking indexing methods on Arrays of Int32.
Int32Pointer
Extension on Pointer specialized for the type argument Int32.
Int64Array
Bounds checking indexing methods on Arrays of Int64.
Int64Pointer
Extension on Pointer specialized for the type argument Int64.
Int8Array
Bounds checking indexing methods on Arrays of Int8.
Int8Pointer
Extension on Pointer specialized for the type argument Int8.
NativeFunctionPointer
Extension on Pointer specialized for the type argument NativeFunction.
NativePort
Extension to retrieve the native Dart_Port from a SendPort.
PointerArray
Bounds checking indexing methods on Arrays of Pointer.
PointerPointer
Extension on Pointer specialized for the type argument Pointer.
StructArray
Bounds checking indexing methods on Arrays of Struct.
StructPointer
Extension on Pointer specialized for the type argument Struct.
Uint16Array
Bounds checking indexing methods on Arrays of Uint16.
Uint16Pointer
Extension on Pointer specialized for the type argument Uint16.
Uint32Array
Bounds checking indexing methods on Arrays of Uint32.
Uint32Pointer
Extension on Pointer specialized for the type argument Uint32.
Uint64Array
Bounds checking indexing methods on Arrays of Uint64.
Uint64Pointer
Extension on Pointer specialized for the type argument Uint64.
Uint8Array
Bounds checking indexing methods on Arrays of Uint8.
Uint8Pointer
Extension on Pointer specialized for the type argument Uint8.
UnionArray
Bounds checking indexing methods on Arrays of Union.
UnionPointer
Extension on Pointer specialized for the type argument Union.

Constants

unsized → const Unsized
This NativeType does not have predefined size.
const Unsized()

Properties

nullptr Pointer<Never>
Represents a pointer into the native C memory corresponding to 'NULL', e.g. a pointer with address 0.
final

Functions

sizeOf<T extends NativeType>() int
Number of bytes used by native type T.

Typedefs

Dart_NativeMessageHandler = Void Function(Int64, Pointer<Dart_CObject>)
NativeFinalizerFunction = NativeFunction<Void Function(Pointer<Void> token)>
The native function type for NativeFinalizers.