Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for bindings for dart and flutter and offering to contribute #135

Open
m-haisham opened this issue Mar 6, 2023 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@m-haisham
Copy link

m-haisham commented Mar 6, 2023

There aren't any official bindings for dart and flutter for this library. I'd like to request that official bindings be created for them so that other developers can easily use this library in their projects.

I'm willing to contribute to the effort and create the bindings myself. I'm familiar with the library and have experience creating bindings for dart. I believe this would be a valuable addition and would benefit many developers who are currently unable to use this library in their projects.

If you think this is a good idea and would like me to proceed with creating the bindings, please let me know. I'd be happy to discuss the requirements and any other details with you.

@wilsonzlin
Copy link
Owner

Thanks for the offer, that sounds great. If you have some work already done, feel free to open a PR and I can take an initial look. Otherwise, happy to discuss an approach here.

@wilsonzlin wilsonzlin added the enhancement New feature or request label Mar 6, 2023
@m-haisham
Copy link
Author

m-haisham commented Mar 6, 2023

I've not yet started. I plan to write c-bindings on the rust side and compile it as a cdylib, then write bindings to it in dart with c-interop.

I'll create a PR when I have some working code

@wilsonzlin
Copy link
Owner

Is there a Rust/Dart library that provides a safer abstraction? A cursory search came up with https://pub.dev/packages/flutter_rust_bridge. I understand it's fundamentally unsafe but if there's an existing library that is well-tested and owns the unsafe parts, that would be ideal. For example, we currently use PyO3, Neon, jni-rs, and Rutie.

Otherwise, the officially-supported c-interop approach sounds good. I have previously written Node.js bindings in C, might be worth looking at: https://github.com/wilsonzlin/minify-html/blob/ec8c4e338a659f4fe82c0499bded398ac4e77eb0/nodejs/binding.c

@m-haisham
Copy link
Author

The interaction required through the C abi is minimal, so I thought about implementing it manually. I'll create a PR with the c-interop for starters as I am more familiar with it. I will also take a look at flutter_rust_bridge in the meanwhile.

@m-haisham
Copy link
Author

I've created a draft PR #136, do take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants