nitro_annotations 0.2.3 copy "nitro_annotations: ^0.2.3" to clipboard
nitro_annotations: ^0.2.3 copied to clipboard

Annotations package for Nitro Modules (Nitrogen). Provides the @NitroModule, @HybridRecord, and other annotations used by the nitro_generator.

nitro_annotations #

Pub Version

A pure-Dart package containing the core annotations and enums for the Nitro Modules (Nitrogen) ecosystem.

This package is designed to be lightweight and has zero dependencies, ensuring it is compatible with all platforms (Flutter, Dart Server, CLI) and can be used in your speculative .native.dart definitions without pulling in the full nitro runtime or any Flutter-specific constraints.

Usage #

Annotations from this package are used by nitro_generator to generate high-performance FFI bridges between Dart and native code (C++, Swift, or Kotlin).

Key Annotations #

  • @NitroModule: Marks a class as a native module.
  • @HybridStruct: Generates high-performance FFI structs for hot-path data transfer.
  • @HybridRecord: Generates JSON-coded classes for complex, infrequent data transfer.
  • @nitroAsync: Offloads synchronous native calls to a background isolate pool.
  • @NitroStream: Configures high-performance native-to-Dart event streams with built-in backpressure strategies (e.g., Backpressure.dropLatest).

Integration #

If you are building a plugin using Nitro, you should typically depend on package:nitro (the runtime), which re-exports everything in this package for convenience.

However, if you are building metadata-based tools or generators (like nitro_generator), you should depend directly on nitro_annotations to keep your project cross-platform and minimize transitive dependencies.


For more details on the Nitro ecosystem, visit The Nitrogen Repository.

0
likes
140
points
0
downloads

Documentation

API reference

Publisher

verified publishershreeman.dev

Weekly Downloads

Annotations package for Nitro Modules (Nitrogen). Provides the @NitroModule, @HybridRecord, and other annotations used by the nitro_generator.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on nitro_annotations