Anyone interested in open-sourcing high-level memory-safe bindgen for Dart/Flutter <--> Rust?

I have made a bindgen to allow Dart/Flutter to call Rust via FFI. It is memory safe, and you do not need to care about anything like allocate/free an object.

Question: Anyone interested in it? If many people are interested, I can polish it can make it open-source. (Since you know, making it open-source will require some time and efforts.)


  • Memory-safe: never need to think about alloc/free.
  • Zero-copy (almost): Big objects can be passed from Rust to Dart without any copy.
  • Rich type support: Not only primitives like int/double, but also Uint8List(Vec), List(Vec), any custom structs. You can even use recursive structs.
  • Async programming: Your Rust code can run for a long time, and it will not block the main isolate (i.e. not block UI). You can call functions directly in main isolate of Dart, so no need for switching between isolates.
  • Easy to use: All you need to do is write down your Rust code. The bindgen will do everything and expose an API in the Dart/Flutter style.


Write the following Rust code (that is all you need to do!):

pub struct TreeNode {
    pub value: i32, # of course, also support other types
    pub children: Vec<MyTreeNode>,

pub fn hello_world(s: MyTreeNode, b: SomeOtherStruct) -> Result<Something> {

It will automatically generate everything, and you only need to call a generated Dart/Flutter API which looks like:

class ExampleApi {
    Future<Something> helloWorld({required MyTreeNode a, required SomeOtherStruct b}) async { ... auto generated implementation ... }

P.S. There already exists a low-level one (in the C style), but all memory alloc/free should be done manually, so it is quite unsafe. That is why I do this high-level bindgen.

Very interested, we have used Flutter FFI technology a long time ago and have deployed App in the store.

We were inspired by brickpop when we first saw it

@0XHyh Indeed this thread is very popular in Rust sub-Reddit . So I have already open-source and published v1.0.

See the GitHub repo: GitHub - fzyzcjy/flutter_rust_bridge: High-level memory-safe binding generator for Flutter/Dart <-> Rust

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.