flutter_rust_bridge
A feature-rich yet seamless Flutter/Dart to Rust binding generator for calling native Rust from Dart.
Repository Health
Technical Analysis
flutter_rust_bridge is a code generator that produces seamless, type-safe bindings between Flutter/Dart and Rust. You write ordinary Rust functions and structs, run the codegen, and get idiomatic Dart APIs that call into your native Rust code across the FFI boundary—handling memory, async, streams, and complex types automatically.
It supports a wide range of Rust and Dart features out of the box: arbitrary types, async functions, streams, error handling, opaque types, and even zero-copy where possible. The project pairs a codegen CLI with a runtime crate (published on crates.io as flutter_rust_bridge) and a matching Dart/Flutter package, making native Rust a practical, low-friction part of any Flutter app.
What You Get
- Automatic generation of type-safe Dart bindings from your Rust functions and types
- Support for async functions, streams, error propagation, and opaque/complex types
- A runtime Rust crate plus a matching Dart/Flutter package that handle FFI marshaling
- Minimal boilerplate—write normal Rust, regenerate, and call it from Dart
Common Use Cases
- Sharing performance-critical Rust logic (crypto, parsing, ML) with a Flutter UI
- Reusing an existing Rust core across mobile, desktop, and web Flutter targets
- Streaming data from Rust to Dart with backpressure-friendly stream sinks
- Calling native async Rust APIs from Dart without hand-written FFI
Under The Hood
Architecture The repository is a multi-language monorepo split into clearly named crates and packages: frb_codegen (the generator that parses Rust and emits Dart + Rust glue), frb_rust (the runtime support crate published as flutter_rust_bridge), frb_dart (the Dart runtime package), frb_macros (proc-macros), plus frb_hooks, frb_utils, and frb_example. The codegen inspects your Rust API and generates marshaling code so complex types, async, and streams cross the FFI boundary safely; the runtime crate supplies handles, executors, and stream sinks the generated code relies on.
Tech Stack It spans Rust and Dart/Flutter, orchestrated with Melos (Dart monorepo tooling), just, and Cargo workspaces. The Rust side uses proc-macros and FFI; the Dart side ships as a pub package. CI, Codecov, and Codacy are wired up, and the project maintains a book/website for documentation.
Code Quality This is a highly mature, extremely active project (hundreds of commits per month, 150+ contributors, Flutter Favorite status) with codecov coverage, extensive examples under frb_example, contribution and security policies, and even AGENTS.md/CLAUDE.md guidance files. The breadth of supported Rust/Dart features is backed by a large test surface.
API Design The developer experience goal is that you write normal Rust and get usable Dart with minimal annotation, which is largely achieved—but the underlying problem (cross-language FFI, build integration, async marshaling) is intrinsically involved, so first-time setup and mental model take real effort. The comprehensive book and examples are the main mitigants for the learning curve.
Used by 2 apps in this directory
LocalSend
Networking
An open-source, cross-platform AirDrop alternative that sends files and messages device-to-device over your local network with no internet, no account, and no cloud server involved.
RustDesk
Networking
Open-source, self-hosted remote desktop built in Rust — your data, your infrastructure, no third-party cloud.