nitro_generator 0.2.0
nitro_generator: ^0.2.0 copied to clipboard
Code generator for Nitro Modules (Nitrogen). Converts *.native.dart specs to Dart FFI, Kotlin, Swift, and C++ bindings.
0.2.0 #
- New:
@HybridRecordBinary Bridge Generator — Generated extensions now use a compact binary protocol (uint8_t*/Pointer<Uint8>) instead of UTF-8 JSON strings, significantly reducing serialization overhead.- Breaking: Extension methods renamed to standard codec names:
fromJson→fromNative/fromReader,toJson→writeFields/toNative. - Full support for
@HybridRecordin Kotlin (.bridge.g.kt) via@Keep data classwith companiondecode/encodemethods. Swift support updated fortoNativeandRecordReaderintegrations.
- Breaking: Extension methods renamed to standard codec names:
- New: Comprehensive Collection Bridging — Added binary-first support for:
List<primitive>(int, double, bool, String) viaRecordWriter.encodePrimitiveList.Map<String, T>using the UTF-8 JSON path (dynamic values).- Nested lists and nullable record fields.
- Improved: Swift Stream Stability — Fixed a compiler error in
_register_*_streamby heap-allocating@HybridStructitems before passing them to the C emit callback. - Improved: Code Quality & Lints — Generated code now follows strict Dart linting rules:
- Cleaned up unbraced for-loops and unused local variable declarations.
- Renamed internal variables to follow public naming conventions (e.g.,
_rawResult→rawResult).
- Testing: Added 28+ regression tests for Kotlin record emission and updated 200+ existing tests to match the binary wire format.
0.1.3 #
- Swift generator: fixed
@_cdeclString type crash (EXC_BAD_ACCESS) —Stringparameters now useUnsafePointer<CChar>?(Cconst char*) and return values useUnsafeMutablePointer<CChar>?(malloc'dchar*), withString(cString:)conversion at the boundary andstrdup()for returns so Dart'stoDartStringWithFree()/free()pairs correctly. - Swift generator: async
String-returning methods useDispatchSemaphore+Task.detachedwith astrdup(result)return. - Swift generator:
Stringproperty getters returnstrdup-allocated C strings; setters acceptUnsafePointer<CChar>?and convert withString(cString:).
0.1.2 #
- Swift generator: replaced
@objc public static func _call_*pattern with top-level@_cdecl("_call_*") public funcstubs. Swift structs and Swift-only protocols cannot cross the Objective-C boundary. - Swift generator:
boolreturn type now maps toInt8(matching C'sint8_t) instead ofBool. - Swift generator: struct-returning functions now return
UnsafeMutableRawPointer?(heap-allocated, caller frees) instead ofAny?.
0.1.1 #
- Renamed package from
nitrogentonitro_generatorto avoid a naming conflict onpub.dev.
0.1.0 #
- Initial release of Nitro code generator.
- Generates Dart FFI, Kotlin, Swift, and C++ bindings.
- Support for
HybridObject,HybridStruct, andHybridEnum. - Support for
@nitroAsyncmethods. - Support for
@NitroStreamwith Backpressure strategies.