Dart frontend for UniFFI bindings
Add uniffi-dart as a dependency in your Cargo.toml:
[dependencies]
uniffi-dart = "0.2.1+v0.31.2"uniffi-dart includes a comprehensive test suite with 30 fixtures covering all major UniFFI functionality:
- Core Types: Primitives, collections, optionals, type limits
- Async Patterns: Comprehensive async/Future support with object-oriented patterns
- Error Handling: Error types, large errors, exception scenarios
- Object-Oriented: Interfaces, constructors, methods, traits
- Time Handling: Timestamps, durations, ISO 8601 formatting
- Performance: FFI call overhead benchmarking
- Documentation: UDL and proc-macro documentation generation
- External Types: Cross-crate type sharing and custom type wrapping
Run all fixture tests:
cargo nextest run --all --nocaptureIf Nix is available, the repository provides development shells with Rust,
Dart, cargo-nextest, and formatting tools:
Enable flakes and the new Nix CLI if they are not already enabled:
mkdir -p ~/.config/nix
printf "experimental-features = nix-command flakes\n" >> ~/.config/nix/nix.confnix develop
nix develop .#msrv
nix develop .#stable
nix develop .#nightlyThe default shell tracks the stable Rust toolchain. The .#msrv shell matches
the declared Rust MSRV, currently 1.85.0.
Run formatting through the flake:
nix fmt -- --ciThe flake formatter covers Nix, Rust, and Dart files. Rust formatting uses the
repository rustfmt.toml; Dart formatting runs with the latest language version.
Run the flake checks:
nix flake checkCI uses this as a Nix smoke check. The existing GitHub Actions workflows remain the authoritative full Rust, Dart, lint, and downstream test suite.
Run the existing fixture test suite from a Nix shell:
nix develop .#msrv -c cargo nextest run --allRun specific fixture tests:
cargo nextest run -p simple_fns --nocapture
cargo nextest run -p dart_async --nocapture
cargo nextest run -p time_types --nocaptureFor nightly compiler features (genco whitespace detection):
cargo +nightly nextest run -p hello_world --nocaptureOur comprehensive fixture suite has identified 5 critical blocking features:
- HashMap/Map support - Core collection type missing
- Proc-macro support - Modern UniFFI development pattern
- Dictionary default values - Named parameters with defaults
- Trait method support - Advanced trait functionality
- BigInt support - Large integer boundary handling
uniffi-dart is versioned independently from uniffi-rs. We follow the SemVer rules from the Cargo Book where versions are compatible when their left-most non-zero component matches. A breaking change is any modification to the generated Dart bindings that requires consumers to update their code.
Because the project is still young, the major version is 0 and most updates bump the minor version.
To keep binding generators in sync, uniffi-dart targets a specific uniffi-rs release. If you use multiple external binding generators, pick versions that target the same uniffi-rs version.
Tags follow the format vX.Y.Z+vA.B.C, where X.Y.Z is the
uniffi-dart version and A.B.C is the targeted uniffi-rs version.
| uniffi-rs target | Latest uniffi-dart release |
|---|---|
| v0.31.2 | v0.2.1+v0.31.2 |
| v0.30.0 | v0.1.1+v0.30.0 |
The code is released under MIT License. See the LICENSE file in the repository root for details.
The project is building on top of the great work of Mozillas UniFFI, with inspirations from other external frontends (like Kotlin and Go) and with the help of the ffi-gen lib. Thanks folks!