-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
flutter: Make bindings work #668
Conversation
@yukibtc I would like your opinion on this |
Hey, sure. I've to finish a PR and I'll review this |
Changes looks good. Regarding the error, I'm unsure about the cause but I was checking if maybe there is some config/dep missing. I noticed that rust_input: crate::api
rust_root: rust/
dart_output: lib/src/rust
full_dep: true
c_output: ios/Classes/frb_generated.h
duplicated_c_output: [macos/Classes/frb_generated.h] But I receive this error: --- stderr
thread 'main' panicked at bindings/nostr-sdk-flutter/rust/build.rs:30:6:
called `Result::unwrap()` on an `Err` value: ffigen failed. Please refer to https://fzyzcjy.github.io/flutter_rust_bridge/manual/ffigen-troubleshooting for details I followed the troubleshooting guide but still not works. |
I see, in general, that the
I think it should be replaced with:
I don't remember how I generated the flutter packet. Maybe I generated it incorrectly (not for bindings). |
I've completely recreated the package and cherry picked your changes. It still return the "Failed to load dynamic library..." error. I think because the rust library name is different from the flutter one: I tried to generate a new package, add the rust code and run the example and works. But when I change the flutter name (or the rust lib name) it no longer works (not find the library, also if I update all the names across the code). I'll try to look for a solution |
@ethicnology I've moved the bindings to https://github.com/rust-nostr/nostr-sdk-flutter Now the example works (run with I tried to rename it to |
I had the same problem with bip85, I ended up re-creating a project with the proper name ( I've also changed the import method in the example using github rather than the relative path |
Description
This PR attempt to make the flutter bindings work.
Notes to the reviewers
The commits can be individually reviewed but I will develop a bit more here:
default
tonew
becausedefault
is the reserved word in dart which was generating errors.2.6.0
to2.0.0
, why ? Because the bindings will be unusable with others frb bindings that don't match the same version. For this reason many frb bindings are staying on 2.0.0 (see bdk-flutter, boltz-flutter, or even my package that I had to change for the same reason bip85flutter_rust_bridge
dependencies it will have to initialize usingNostrSdk.init()
to avoid conflicts with others flutter_rust_bridge dependencies if they still keepRustLib.init()
I'm trying to share my own experience building bip85 bindings using frb.
As I transferred the
nostr
namespace to you on pub.dev, I also recommend renaming the flutter packagenostr
instead ofnostr_sdk
to benefit from visibility.However the example app doesn't work yet, due to the following error, but it may due to my environement or something I missed in the changes you've implemented in the bindings:
Checklist
just precommit
orjust check
before committing–> My changes apply only to dart bindings
–> still more work need to be done