# fzyzcjy/flutter_rust_bridge

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/fzyzcjy-flutter-rust-bridge).**

5,106 stars · 385 forks · Dart · mit

## Links

- GitHub: https://github.com/fzyzcjy/flutter_rust_bridge
- Homepage: https://fzyzcjy.github.io/flutter_rust_bridge/
- awesome-repositories: https://awesome-repositories.com/repository/fzyzcjy-flutter-rust-bridge.md

## Topics

`bindgen` `dart` `ffi` `flutter` `rust`

## Description

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](https://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.

## Tags

### Development Tools & Productivity

- [Type-Safe Binding Generators](https://awesome-repositories.com/f/development-tools-productivity/type-safe-binding-generators.md) — Generates type-safe Dart bindings from Rust functions with automatic serialization, async support, and type conversion.
- [Rust-Dart FFI Generators](https://awesome-repositories.com/f/development-tools-productivity/type-safe-binding-generators/rust-dart-ffi-generators.md) — Automatically generates type-safe Dart bindings for Rust functions with async and serialization support.
- [Background Task Schedulers](https://awesome-repositories.com/f/development-tools-productivity/background-task-schedulers.md) — Schedules native function calls onto background threads and returns Dart futures for non-blocking execution.
- [Build-Time Code Generators](https://awesome-repositories.com/f/development-tools-productivity/build-time-code-generators.md) — Automatically generates Dart bindings from Rust types during the build process. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/misc-features))
- [Project Scaffolding Commands](https://awesome-repositories.com/f/development-tools-productivity/custom-command-execution/initialization-commands/project-scaffolding-commands.md) — Ships a one-command CLI scaffold that initializes a new Flutter-Rust project with all glue code and configuration. ([source](https://cdn.jsdelivr.net/gh/fzyzcjy/flutter_rust_bridge@master/README.md))

### Game Development

- [Cross-Language Function Bridges](https://awesome-repositories.com/f/game-development/python-plugin-development/cross-language-function-bridges.md) — Generates glue code that lets Dart call Rust functions directly with automatic type conversion and async support. ([source](https://cdn.jsdelivr.net/gh/fzyzcjy/flutter_rust_bridge@master/README.md))

### Operating Systems & Systems Programming

- [Native Type Bridges](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/system-programming-primitives/system-abstractions/native-interoperability-bindings/native-system-integrations/native-api-bridges/native-type-bridges.md) — Generates serialization bridges for user-defined Rust structs and enums so they can be passed to Dart. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/types))

### Programming Languages & Runtimes

- [Bidirectional Cross-Language Calls](https://awesome-repositories.com/f/programming-languages-runtimes/bidirectional-cross-language-calls.md) — Enables seamless function calls in both directions between Dart and Rust.
- [Annotation-Driven Binding Customizations](https://awesome-repositories.com/f/programming-languages-runtimes/c-language-bridges/rust-bridges/annotation-driven-binding-customizations.md) — Provides annotation-driven control over which Rust items are exposed and how they are named in generated Dart bindings. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/misc-features))
- [C FFI Bridges](https://awesome-repositories.com/f/programming-languages-runtimes/c-language-bridges/rust-c-bridges/c-ffi-bridges.md) — Uses C ABI to enable direct, low-overhead calls between Rust and Dart.
- [Managed-to-Native Callbacks](https://awesome-repositories.com/f/programming-languages-runtimes/function-pointer-callbacks/managed-to-native-callbacks.md) — Enables Rust code to invoke Dart callbacks, supporting bidirectional communication between the two languages. ([source](https://cdn.jsdelivr.net/gh/fzyzcjy/flutter_rust_bridge@master/README.md))
- [Cross-Language](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/trait-implementations/cross-language.md) — Converts Rust trait implementations into Dart classes that implement the corresponding abstract interface. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/traits))
- [Cross-Language Trait Object Bridges](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/trait-implementations/trait-object-polymorphism/cross-language-trait-object-bridges.md) — Converts Rust traits into Dart abstract classes and enables passing trait objects between the languages.
- [FFI Trait Object Passing](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/trait-implementations/trait-object-polymorphism/ffi-trait-object-passing.md) — Allows Dart code to pass any implementing type to Rust functions that accept or return trait objects. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/traits))
- [Cross-Language Class Wrappers](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/interoperability/javascript-to-native-bridges/native-class-wrappers/cross-language-class-wrappers.md) — Creates Dart wrappers that maintain state across calls for persistent Rust struct instances.
- [Trait-to-Abstract-Class Conversions](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/type-definition-systems/abstract-classes/trait-to-abstract-class-conversions.md) — Automatically translates Rust trait definitions into Dart abstract classes that can be implemented on either side. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/traits))
- [Third-Party Crate Bindings](https://awesome-repositories.com/f/programming-languages-runtimes/c-language-bridges/rust-bridges/third-party-crate-bindings.md) — Generates Dart bindings for third-party Rust crates, eliminating the need to write manual wrapper code. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/))
- [Instance Method Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/direct-native-method-mapping/instance-method-mappings.md) — Maps Rust instance methods into instance methods on the generated Dart wrapper class. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/functions))
- [Trait Object Polymorphism](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/trait-implementations/trait-object-polymorphism.md) — Boxes Rust trait objects behind a vtable to allow Dart code to implement and call trait methods.
- [Macro-Expanded Type Resolutions](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/metaprogramming-macros/custom-macro-definitions/macro-expanded-type-resolutions.md) — Discovers types and functions produced by Rust macros so generated Dart bindings include all referenced items. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/miscellaneous))
- [Constructor Mappings](https://awesome-repositories.com/f/programming-languages-runtimes/language-interoperability/interoperability/javascript-to-native-bridges/native-class-wrappers/constructor-mappings.md) — Translates Rust struct creation functions into constructors on the corresponding Dart wrapper class. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/functions))
- [Struct Property Accessors](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-structures/struct-generators/struct-property-accessors.md) — Generates getter and setter properties for Rust struct fields in Dart wrappers for convenient field access. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/functions))

### Software Engineering & Architecture

- [Async](https://awesome-repositories.com/f/software-engineering-architecture/binary-linking-interfaces/ffi-interfaces/async.md) — Transforms synchronous Rust functions into Dart async methods with background thread management and cancellation.
- [Native Computation Offloading](https://awesome-repositories.com/f/software-engineering-architecture/binary-linking-interfaces/ffi-interfaces/async/native-computation-offloading.md) — Offloads heavy Rust computations to background threads, keeping the Flutter UI responsive.
- [Compile-Time Code Generation](https://awesome-repositories.com/f/software-engineering-architecture/compile-time-code-generation.md) — Generates Dart bindings from Rust source code automatically during compilation.
- [Cross-Language Type Translation](https://awesome-repositories.com/f/software-engineering-architecture/native-bridges/native-bridge-memory-management/cross-language-type-translation.md) — Automatically translates complex Rust types like structs, enums, and streams into Dart equivalents. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/))
- [Native Object Interoperability](https://awesome-repositories.com/f/software-engineering-architecture/object-mapping-apis/native-object-accessors/native-object-interoperability.md) — Wraps Rust structs as Dart objects with persistent state and mutable properties.
- [Persistent Native Object States](https://awesome-repositories.com/f/software-engineering-architecture/state-management/object-state-trackers/persistent-native-object-states.md) — Creates persistent Rust objects whose state is accessible and modifiable from Dart across multiple function calls. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/how-to))

### Data & Databases

- [Binary Serialization Formats](https://awesome-repositories.com/f/data-databases/binary-serialization-formats.md) — Encodes typed data structures into compact binary format for efficient cross-language exchange.
- [Complex Data Serialization](https://awesome-repositories.com/f/data-databases/complex-data-serialization.md) — Serializes complex Rust types like structs and enums into Dart equivalents using Protobuf or JSON.
- [Serialization Format Mappings](https://awesome-repositories.com/f/data-databases/custom-data-types/serialization-format-mappings.md) — Supports switching between serialization backends like Protobuf and JSON for cross-language data exchange. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/how-to))

### Mobile Development

- [Native Backend UIs](https://awesome-repositories.com/f/mobile-development/cross-platform-frameworks/flutter/native-backend-uis.md) — Ships utilities to use Flutter as the graphical layer for Rust applications.
- [Native Integrations](https://awesome-repositories.com/f/mobile-development/cross-platform-frameworks/flutter/native-integrations.md) — Ships build scripts and platform initialization to seamlessly integrate Rust code into Flutter applications.

### Web Development

- [Native Panic-to-Exception Bridges](https://awesome-repositories.com/f/web-development/error-handling/native-error-reporters/native-panic-to-exception-bridges.md) — Captures Rust panics and errors and surfaces them as Dart exceptions for structured error handling. ([source](https://fzyzcjy.github.io/flutter_rust_bridge/guides/how-to))
