nitro_generator 0.1.3 copy "nitro_generator: ^0.1.3" to clipboard
nitro_generator: ^0.1.3 copied to clipboard

Code generator for Nitro Modules (Nitrogen). Converts *.native.dart specs to Dart FFI, Kotlin, Swift, and C++ bindings.

0.1.3 #

  • Swift generator: fixed @_cdecl String type crash (EXC_BAD_ACCESS)String parameters now use UnsafePointer<CChar>? (C const char*) and return values use UnsafeMutablePointer<CChar>? (malloc'd char*), with String(cString:) conversion at the boundary and strdup() for returns so Dart's toDartStringWithFree() / free() pairs correctly. Fixes an immediate crash on any method that takes or returns a String.
  • Swift generator: async String-returning methods use DispatchSemaphore + Task.detached with a strdup(result) return, matching the synchronous C ABI required by @_cdecl.
  • Swift generator: String property getters return strdup-allocated C strings; setters accept UnsafePointer<CChar>? and convert with String(cString:).
  • Swift generator: default fallback value for String returns changed from "" to strdup("") to maintain consistent allocator pairing.
  • Updated README: fixed the @_cdecl("_call_processFile") example to show the correct C pointer types instead of the old (crashing) String param/return pattern; added link to new docs/swift-type-mapping.md.

0.1.2 #

  • Swift generator: replaced @objc public static func _call_* pattern with top-level @_cdecl("_call_*") public func stubs. Swift structs and Swift-only protocols cannot cross the Objective-C boundary; @_cdecl exports plain C symbols that the generated C++ shim can call with extern "C".
  • Swift generator: bool return type now maps to Int8 (matching C's int8_t) instead of Bool.
  • Swift generator: struct-returning functions now return UnsafeMutableRawPointer? (heap-allocated, caller frees) instead of Any?.
  • Swift generator: async struct functions use DispatchSemaphore + Task.detached to bridge async Swift to the synchronous C ABI required by @_cdecl.
  • Swift generator: NitroBatteryRegistry (and all registries) no longer inherit NSObject or use @objc — pure Swift classes.
  • Added 10 new SwiftGenerator tests covering the above patterns.
  • Fixed failing test that expected the old @objc public static func _call_add( pattern.

0.1.1 #

  • Renamed package from nitrogen to nitro_generator to avoid a naming conflict on pub.dev.

0.1.0 #

  • Initial release of Nitro code generator.
  • Generates Dart FFI, Kotlin, Swift, and C++ bindings.
  • Support for HybridObject, HybridStruct, and HybridEnum.
  • Support for @nitroAsync methods.
  • Support for @NitroStream with Backpressure strategies.
0
likes
0
points
272
downloads

Documentation

Documentation

Publisher

verified publishershreeman.dev

Weekly Downloads

Code generator for Nitro Modules (Nitrogen). Converts *.native.dart specs to Dart FFI, Kotlin, Swift, and C++ bindings.

Homepage
Repository (GitHub)
View/report issues

Topics

#codegen #ffi #flutter #native #bridge

Funding

Consider supporting this project:

buymeacoffee.com

License

unknown (license)

Dependencies

analyzer, build, dart_style, nitro, path, source_gen

More

Packages that depend on nitro_generator