nitro
0.8.8, released 5 days ago by shreeman.dev
Zero-overhead native FFI bindings and runtime layer for Flutter plugins
What it does
Nitro provides the base classes, annotations, and runtime primitives for writing type-safe, zero-copy FFI plugins across iOS, Android, macOS, Windows, Linux, and Web with no method-channel overhead. It supports synchronous calls, async isolate dispatch, native streams, and zero-copy structs.
AI-written summary of version 0.8.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are authoring high-performance native plugins for Flutter using FFI
- You need zero-copy data transfer between Dart and native memory (like camera frames or audio)
- You want type-safe native module bridges without manual boilerplate or method channel overhead
Skip it when
- You are building a standard app developer project and not developing a Nitrogen-powered native plugin
- Your project does not require native FFI modules and standard method channels suffice
Strengths
- Extremely low call overhead (~0 ms)
- Type-safe generated bridges for Swift, Kotlin, and C++
- Zero-copy buffer support via @HybridStruct and NitroBuffer
- Automatic and adaptive worker pool for async calls
Weaknesses
- Requires using the separate code generator and CLI tooling
- Requires writing native implementations in Swift, Kotlin, or C++
Setup
- Kind
- FFI (native library)
- Effort
- High
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Requires setting up nitrogen tooling, native implementation code for each target platform, and correct minimum platform versions (such as iOS 13+ and Android NDK 26.1+).
import 'package:nitro/nitro.dart';
part 'math.g.dart';
@NitroModule(ios: AppleNativeImpl.swift, android: AndroidNativeImpl.kotlin)
abstract class Math extends HybridObject {
static final Math instance = _MathImpl();
double add(double a, double b);
@nitroAsync
Future<String> compute(String expression);
}Alternatives
Packages that do the same job and could replace nitro.
Works with
Packages commonly used together with nitro: ones it builds on, ones built on it, and its own family.