nitro_annotations library
Classes
- AndroidNativeImpl
- Accepted by NitroModule.android.
- AppleNativeImpl
- Accepted by NitroModule.ios and NitroModule.macos.
- 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.
- HybridEnum
- 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.
- KotlinImpl
- Kotlin + JNI bridge. Valid on Android only.
- LinuxNativeImpl
- Accepted by NitroModule.linux.
- MainThread
- NativeImpl
- Backward-compatible shorthand namespace. Prefer the per-platform constants (AppleNativeImpl, AndroidNativeImpl, WindowsNativeImpl, LinuxNativeImpl, WebNativeImpl) for clarity.
- NitroAsync
- NitroCustomType
-
Registers a Dart class as a custom FFI bridge type encoded by a
NitroFfiCodec. - NitroEntryPoint
- NitroFast
- NitroModule
- NitroNativeAsync
- NitroOwned
-
Marks that the native side heap-allocates the returned
NativeHandleand Dart takes ownership. The generator will: - NitroResult
- Marks a method's return type as a discriminated success/error result.
- 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).
- SwiftImpl
- Swift + @_cdecl bridge. Valid on Apple platforms (iOS and macOS) only.
- WasmImpl
- WASM/JS interop bridge. Valid on Web only — dart:ffi is unavailable on web.
- WebNativeImpl
- Accepted by NitroModule.web.
- WindowsNativeImpl
- Accepted by NitroModule.windows.
- ZeroCopy
Enums
Constants
- hybridRecord → const HybridRecord
- mainThread → const MainThread
- Runs the Kotlin/Swift implementation of this method on the platform's main/UI thread instead of the calling thread.
- nitroAsync → const NitroAsync
- nitroEntryPoint → const NitroEntryPoint
-
Marks a top-level
Future<String> Function(String)(orString Function(String)) in the spec file as a background entry point: native can run it in a fresh isolate even while no Flutter UI is running (a WorkManager job, a push handler, a BGTask), hand it a string argument, and receive the string result. The generator emits the@pragma('vm:entry-point')wrapper that keeps the function alive under AOT, so the function itself needs no pragma. - nitroFast → const NitroFast
-
Marks a synchronous method as a hot path: the binding is
isLeaf: trueand the generated body is a bare call — nocallSyncclosure, no logging/slow-call/timeline diagnostics. Measured on Apple Silicon this takes a generated call from ~260 ns to ~13 ns, level with a hand-writtendart:ffibinding. The error slot is read in debug builds only (inside anassert), so a native throw surfaces as aHybridExceptionduring development and costs nothing in profile/release. - nitroNativeAsync → const NitroNativeAsync
- nitroOwned → const NitroOwned
-
Const shorthand for
@NitroOwned. - nitroResult → const NitroResult
-
Const shorthand for
@NitroResult. - nitroVariant → const NitroVariant
-
Const shorthand for
@NitroVariant. - zeroCopy → const ZeroCopy