FFI support in Dart

Today Dart.dev announced v2.5 with preiew off c-interop, with Dart focus on the UI for all platforms, mobile and desktop,

I think Rust could have a role to play here as well, and the performance and usability of Rust-Dart interaction can help alot, I already tried this before but with intermeduate channel that is no more required

And:

Maybe Dart triggering WebAssembly code would one option for Rust interaction.

The first step would probably be development of a cbindgen equivalent for Dart. I.e. generate the Dart ffi binding code from the Rust declarations (or, I suppose, C header). I don't think such a tool exists.

I think C header -> Dart declaration would be best, so we'd go Rust -> C -> Dart. After all, it is the C ABI we're communicating over. Such a tool should probably be written in communication with the Dart community and, depending on relative support for the workload, potentially written in Dart. (After all, the Dart community would know more about the minutia of the task, and are more likely to be able to contribute to a Dart project than a Rust one.)

After that, it's a matter of providing ways of doing the actual interop. Theoretically, it's as simple as making sure the declarations on both sides match, then just compiling and linking both ends.

I'm (very slowly) learning Dart/Flutter in some of my spare time (though I have plenty of JVM experience with Java/Kotlin), and would love to help out with such a project. Someone with at least some experience in the Dart community (such as where you'd actually advertise the dart-bindgen tool) should probably lead the project, though.

Did a little Google sleuthing, found PixelToast/dart-bindgen.