flutter_rust_bridge is a code generation tool that automatically creates type‑safe Dart bindings for Rust functions, enabling direct cross‑language calls between Flutter and a Rust backend. It provides an async FFI adapter that transforms synchronous Rust functions into Dart async methods with background thread management, a cross‑language object manager that wraps persistent Rust structs as Dart objects preserving state across calls, and trait object interop that converts Rust traits into Dart abstract classes for seamless bidirectional use.
The project handles the full lifecycle of integrating a systems language with a UI framework: you can run CPU‑intensive Rust computations asynchronously without blocking the Flutter UI, invoke Dart callbacks from Rust, serialize complex Rust types (structs, enums, collections) into Dart equivalents, and expose Rust struct instances as mutable Dart objects. It also supports using Flutter as the graphical layer for Rust applications, and automatically generates bindings with automatic type conversion and threading.
Beyond the core binding generation, the toolset covers build and deployment infrastructure across platforms – Android NDK setup, compilation, code generation, library loading, prebuilt binary support, and WebAssembly CORS configuration. It offers annotation‑driven binding customization, custom code injection, one‑command project initialization, workspace integration, and function mocking for isolated testing. The type and data translation layer handles complex types, custom serialization formats (Protobuf, JSON), macro‑expanded types, default parameter mapping, and constant exposure, while performance features include call hooks for instrumentation, error propagation, task cancellation, object pooling, and zero‑copy binary data transfer.
The project is documented at flutter_rust_bridge.inquire.sh and can be installed via pub or cargo with a single CLI command to scaffold a new Flutter‑Rust project.