nitro
library
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.
AndroidNativeImpl
Accepted by NitroModule.android .
AnyNativeObject
An opaque reference to any registered native implementation.
AppleNativeImpl
Accepted by NitroModule.ios and NitroModule.macos .
Arena
An Allocator which frees all allocations at the same time.
Array <T extends NativeType >
A fixed-sized array of Ts.
Bool
Represents a native bool in C.
ByteBuffer
A sequence of bytes underlying a typed data object.
ByteData
A fixed-length, random-access sequence of bytes that also provides random
and unaligned access to the fixed-width integers and floating point
numbers represented by those bytes.
BytesBuilder
Builds a list of bytes, allowing bytes and lists of bytes to be added at the
end.
CallocAllocator
Manages memory on the native heap.
Char
The C char type.
CppImpl
Direct C++ via CMake/FFI. Valid on all native platforms.
Implements all native-platform sealed interfaces so it is accepted by
every NitroModule platform field except NitroModule.web .
Dart_CObject
Opaque, not exposing it's members.
DartRepresentationOf
DefaultAsset
Annotation specifying the default asset ID for the current library.
Double
Represents a native 64 bit double in C.
DynamicLibrary
A dynamically loaded native library.
Endian
Endianness of number representation.
Finalizable
Marker interface for objects which should not be finalized too soon.
Float
Represents a native 32 bit float in C.
Float32List
A fixed-length list of IEEE 754 single-precision binary floating-point
numbers that is viewable as a TypedData .
Float32x4
Four 32-bit floating point values.
Float32x4List
A fixed-length list of Float32x4 numbers that is viewable as a
TypedData .
Float64List
A fixed-length list of IEEE 754 double-precision binary floating-point
numbers that is viewable as a TypedData .
Float64x2
Float64x2 immutable value type and operations.
Float64x2List
A fixed-length list of Float64x2 numbers that is viewable as a
TypedData .
Handle
Represents Dart_Handle from dart_api.h in C.
HybridEnum
HybridObject
HybridRecord
Marks a Dart class as a rich, binary-serialized record type for use as
method parameters, return types, or stream items in a @NitroModule.
HybridStruct
Value type that bridges with C-ABI struct layout.
Int
The C int type.
Int16
Represents a native signed 16 bit integer in C.
Int16List
A fixed-length list of 16-bit signed integers that is viewable as a
TypedData .
Int32
Represents a native signed 32 bit integer in C.
Int32List
A fixed-length list of 32-bit signed integers that is viewable as a
TypedData .
Int32x4
Int32x4 and operations.
Int32x4List
A fixed-length list of Int32x4 numbers that is viewable as a
TypedData .
Int64
Represents a native signed 64 bit integer in C.
Int64List
A fixed-length list of 64-bit signed integers that is viewable as a
TypedData .
Int8
Represents a native signed 8 bit integer in C.
Int8List
A fixed-length list of 8-bit signed integers.
IntPtr
The C intptr_t type.
IsolatePool
A fixed pool of long-lived worker isolates with a persistent reply port .
KotlinImpl
Kotlin + JNI bridge. Valid on Android only.
LazyRecordList <T >
A read-only List backed directly by a native binary buffer produced by
RecordWriter.encodeIndexedList .
LinuxNativeImpl
Accepted by NitroModule.linux .
Long
The C long int, aka. long, type.
LongLong
The C long long type.
MainThread
MallocAllocator
Manages memory on the native heap.
Native <T >
Annotation binding an external declaration to its native implementation.
NativeApi
Utilities for accessing the Dart VM API from Dart code or
from C code via dart_api_dl.h.
NativeCallable <T extends Function >
A native callable which listens for calls to a native function.
NativeFinalizer
A native finalizer which can be attached to Dart objects.
NativeFunction <T extends Function >
Represents a function type in C.
NativeHandle <T extends NativeType >
A lightweight wrapper around a raw native pointer that crosses the Nitro
bridge without any codec overhead.
NativeImpl
Backward-compatible shorthand namespace.
Prefer the per-platform constants (AppleNativeImpl , AndroidNativeImpl ,
WindowsNativeImpl , LinuxNativeImpl , WebNativeImpl ) for clarity.
NativeType
NativeType 's subtypes represent a native type in C.
NitroAnyBool
NitroAnyDouble
NitroAnyInt
NitroAnyList
NitroAnyMap
NitroAnyNull
NitroAnyObject
NitroAnyString
NitroAnyValue
NitroAsync
NitroBoolCodec
Built-in codec for bool? — backed by NitroOptBool .
NitroBoolWireCodec
Built-in wire codec for bool? — the byte layout of NitroOptBool
([1B hasValue][1B value], packed).
NitroCoalescer
Demultiplexer for coalesced @nitroNativeAsync completions.
NitroConfig
Global configuration for the Nitro runtime.
NitroCustomType
Registers a Dart class as a custom FFI bridge type encoded by a NitroFfiCodec .
NitroDoubleCodec
Built-in codec for double? — backed by NitroOptFloat64 .
NitroDoubleWireCodec
Built-in wire codec for double? — the byte layout of NitroOptFloat64
([1B hasValue][8B float64 LE], packed).
NitroErr <T extends Object ? >
Failure case — carries the native-side error message.
NitroErrorFfi
A C-compatible struct for passing exception data over the FFI boundary.
NitroFfiCodec <T extends Object >
Codec for a type T that can be transported across the C FFI bridge as an
optional value. This is the Dart/FFI equivalent of RN Nitro's
JSIConverter<std::optional<T>>.
NitroInstanceRegistry
Dart-side registry mapping native instance IDs to live impl objects.
NitroIntCodec
Built-in codec for int? — backed by NitroOptInt64 .
NitroIntWireCodec
Built-in wire codec for int? — the byte layout of NitroOptInt64
([1B hasValue][8B int64 LE], packed).
NitroModule
NitroNativeAllocator
An Allocator backed by a module's exported <lib>_nitro_alloc /
<lib>_nitro_free symbols (plain C-runtime malloc/free).
NitroNativeAsync
NitroNullableBool
Collision-free nullable bool for Nitro bridges.
NitroNullableDouble
Collision-free nullable double for Nitro bridges.
NitroNullableInt
Collision-free nullable int for Nitro bridges.
NitroOk <T extends Object ? >
Success case — carries the native return value.
NitroOptBool
NitroOptFloat64
NitroOptInt64
NitroOwned
Marks that the native side heap-allocates the returned NativeHandle and
Dart takes ownership. The generator will:
NitroPromise <T >
A composable async primitive that mirrors RN Nitro's Promise<T>.
NitroResult
Marks a method's return type as a discriminated success/error result.
NitroResultValue <T extends Object ? >
Discriminated success/error result for native methods annotated with
@NitroResult().
NitroRuntime
The runtime is called only by generated code.
Plugin authors and app developers interact with NitroConfig instead.
NitroStream
NitroStreamBatch
@NitroStream with batch backpressure configuration.
Example: @NitroStream(backpressure: Backpressure.batch, batchMaxSize: 64)
NitroTuple
Marks a Dart 3 positional record typedef as a named tuple type.
NitroVariant
Marks a Dart sealed class as a discriminated union type (sum type / tagged union).
NitroWireCodec <T extends Object >
Platform-neutral codec for a @NitroCustomType T transported across the
bridge as an optional fixed-size value: [1B hasValue][encodedSize-1 bytes].
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.
ReceivePort
Together with SendPort , the only means of communication between isolates.
RecordReader
Streaming binary reader for @HybridRecord types (native dart:ffi edge).
RecordReaderBase
Platform-neutral core of the @HybridRecord binary reader.
RecordWriter
Streaming binary writer for @HybridRecord types (native dart:ffi edge).
RecordWriterBase
Platform-neutral core of the @HybridRecord binary writer.
SendPort
Sends messages to its ReceivePort s.
Short
The C short type.
SignedChar
The C signed char type.
Size
The C size_t type.
SizedNativeType
A NativeType with a known size.
Struct
The supertype of all FFI struct types.
SwiftImpl
Swift + @_cdecl bridge. Valid on Apple platforms (iOS and macOS) only.
TypedData
A typed view of a sequence of bytes.
TypedDataList <E >
A TypedData fixed-length List -view on the bytes of buffer .
Uint16
Represents a native unsigned 16 bit integer in C.
Uint16List
A fixed-length list of 16-bit unsigned integers that is viewable as a
TypedData .
Uint32
Represents a native unsigned 32 bit integer in C.
Uint32List
A fixed-length list of 32-bit unsigned integers that is viewable as a
TypedData .
Uint64
Represents a native unsigned 64 bit integer in C.
Uint64List
A fixed-length list of 64-bit unsigned integers that is viewable as a
TypedData .
Uint8
Represents a native unsigned 8 bit integer in C.
Uint8ClampedList
A fixed-length list of 8-bit unsigned integers.
Uint8List
A fixed-length list of 8-bit unsigned integers.
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.
Utf16
The contents of a native zero-terminated array of UTF-16 code units.
Utf8
The contents of a native zero-terminated array of UTF-8 code units.
VarArgs <T extends Record >
The types of variadic arguments passed in C.
Void
Represents a void type in C.
WasmImpl
WASM/JS interop bridge. Valid on Web only — dart:ffi is unavailable on web.
WChar
The C wchar_t type.
WebNativeImpl
Accepted by NitroModule.web .
WindowsNativeImpl
Accepted by NitroModule.windows .
ZeroCopy
ZeroCopyBuffer
Zero-copy buffer backed by uint8_t* — maps to Uint8List .
ZeroCopyFloat32Buffer
Zero-copy buffer backed by float* — maps to Float32List .
ZeroCopyFloat64Buffer
Zero-copy buffer backed by double* — maps to Float64List .
ZeroCopyInt16Buffer
Zero-copy buffer backed by int16_t* — maps to Int16List .
ZeroCopyInt32Buffer
Zero-copy buffer backed by int32_t* — maps to Int32List .
ZeroCopyInt64Buffer
Zero-copy buffer backed by int64_t* — maps to Int64List .
ZeroCopyInt8Buffer
Zero-copy buffer backed by int8_t* — maps to Int8List .
ZeroCopyUint16Buffer
Zero-copy buffer backed by uint16_t* — maps to Uint16List .
ZeroCopyUint32Buffer
Zero-copy buffer backed by uint32_t* — maps to Uint32List .
Properties
nullptr
→ Pointer <Never >
Represents a pointer into the native C memory corresponding to 'NULL', e.g.
a pointer with address 0.
final
zoneArena
→ Arena
A zone-specific Arena .
no setter
Functions
decodeUtf8NoBomStrip (Uint8List bytes )
→ String
Decodes UTF-8 bytes to a Dart String without stripping leading U+FEFF.
dart:convert's Utf8Decoder treats a leading BOM (U+FEFF / 0xEF 0xBB 0xBF)
as a stream signature and drops it. Bridge strings are raw data, not
streams.
getInt64LE (ByteData data , int offset )
→ int
Reads a little-endian int64 at offset.
jsonDecode (String source , {Object ? reviver (Object ? key , Object ? value )? })
→ dynamic
Parses the string and returns the resulting Json object.
jsonEncode (Object ? object , {Object ? toEncodable (Object ? nonEncodable )? })
→ String
Converts object to a JSON string.
nitroAnyMapFromNative (Pointer <Uint8 > ptr )
→ NitroAnyMap
Decode a NitroAnyMap from a native pointer produced by NitroAnyMapNative.toNative
or the C bridge.
nitroNullableBoolFromNative (Pointer <Uint8 > ptr )
→ NitroNullableBool
Decodes a NitroNullableBool from a framed native buffer.
nitroNullableDoubleFromNative (Pointer <Uint8 > ptr )
→ NitroNullableDouble
Decodes a NitroNullableDouble from a framed native buffer.
nitroNullableIntFromNative (Pointer <Uint8 > ptr )
→ NitroNullableInt
Decodes a NitroNullableInt from the framed buffer produced by
toNative / a native bridge.
setInt64LE (ByteData data , int offset , int value )
→ void
Writes a little-endian int64 at offset. See getInt64LE for the
per-compiler contract.
sizeOf <T extends SizedNativeType > ()
→ int
Number of bytes used by native type T.
using <R > (R computation (Arena arena ), [Allocator wrappedAllocator = calloc ])
→ R
Runs computation with a new Arena , and releases all allocations at the
end.
withArena <T > (T action (Arena arena ) )
→ T
withZoneArena <R > (R computation (), [Allocator wrappedAllocator = calloc ])
→ R
Creates a zoned Arena to manage native resources.
Exceptions / Errors
HybridException
Represents a native exception propagated from Kotlin, Swift, or C++.