Skip to content

Add dart/flutter bindings to livekit-uniffi#1183

Open
jhugman wants to merge 5 commits into
mainfrom
jhugman/dart-bindings
Open

Add dart/flutter bindings to livekit-uniffi#1183
jhugman wants to merge 5 commits into
mainfrom
jhugman/dart-bindings

Conversation

@jhugman

@jhugman jhugman commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Before you submit your PR

Make sure the following is true before submitting your PR:

  • I have read the contributing guidelines and validated that this PR will be accepted.
  • I have read and followed the principles regarding breaking changes, testing, and code quality.

PR description

Added Dart bindings with the uniffi-dart bindgen. This generates a Native Assets API. Exercise with cargo make bindgen-dart.

This adds a uniffi-bindgen-dart feature to the livekit-uniffi crate: followup would be to separate out the uniffi-tooling binaries in to a workspace centred tooling crate.

Added consumable package, with a hook/build.dart. This works both locally, and by downloading a prebuilt cdylib.

Added CI which builds the cdylibs per OS/architecture on release.

Breaking changes

No changes breaking changes are made, however:

  • uniffi-dart bindgen needed a bug fix which means the version of uniffi-dart is from main (pinned to the hash).
  • the version of uniffi is incremented to 0.31. This is unlikely to cause breakage in the Swift, Python, Kotlin bindings, but may cause problems for uniffi-bindgen-node. Followup: move uniffi-bindgen-node to uniffi-bindgen-react-native.

MSRV

No changes. uniffi 0.31 requires >= 1.85

Testing

  • Dart package tests (support/dart/tests): a smoke test including a negative case.
  • CI build & hook/build.dart tested via dry run.

Async

We want the project to be runtime-agnostic, so please reuse what's already in livekit-runtime and feel free to add anything missing. It's ok to use Tokio directly, when writing unit tests, if necessary. When testing, do not use artificial delays for the state to "catch up"; instead, respect the event flow and subscribe properly using channels or other mechanisms.

@jhugman jhugman requested review from ladvoc and pblazej as code owners June 23, 2026 13:11
@github-actions

Copy link
Copy Markdown
Contributor

Changeset

The following package versions will be affected by this PR:

Package Bump
livekit-uniffi minor

jhugman added 4 commits June 23, 2026 16:50
Release/multi-platform delivery for the Dart package:
- uniffi-cdylib.yml builds liblivekit_uniffi for desktop + mobile targets and
  attaches build-<triple>.zip (+ .sha256) to the livekit-uniffi release; wired
  into uniffi-packages.yml. Validated across all 10 targets via CI dry-run.
- hook/build.dart.tera gains a download mode: fetches and SHA-256-verifies the
  prebuilt library for the target when no local build is present.
Ship tests in support/dart/test, copied into the generated package by the
dart-package flow. Covers the FFI smoke path (buildVersion) and a real
JWT/HMAC round-trip (generate -> verify -> decode, plus wrong-secret rejection)
to exercise Rust logic across the boundary.
uniffi-dart-test.yml builds the Dart package (host cdylib + bindings via
cargo make dart-package) and runs dart test on PRs/pushes touching
livekit-uniffi or its dependencies. The dart build keeps symbols
(CARGO_PROFILE_RELEASE_STRIP=false) so library-mode bindgen can read the
UNIFFI_META_* metadata, which the release strip removes on Linux.
@jhugman jhugman force-pushed the jhugman/dart-bindings branch from cdd271c to c60ae51 Compare June 23, 2026 15:50
@jhugman jhugman requested review from 1egoman and hiroshihorie June 23, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant