Closed ethicnology closed 2 weeks ago
Hi, automatically scanning a whole third party package is experimental feature and may not support too complex arbitrary packages (since there are so many corner cases for Rust). Looks like nostr may contain some edge cases that does not support yet. But feel free to use the https://cjycode.com/flutter_rust_bridge/guides/third-party/manual manual way or to improve this experimental feature!
Thanks to your last answer I've took the manual way
I've created a simple function that consume the third party crate:
use nostr::key::{Keys, SecretKey};
#[flutter_rust_bridge::frb(init)]
pub fn init_app() {
flutter_rust_bridge::setup_default_user_utils();
}
#[flutter_rust_bridge::frb(sync)]
pub fn generate_nostr_keys() -> (String, String) {
let keys = Keys::generate();
let secret = keys.secret_key().to_secret_hex();
let public = keys.public_key().to_string();
return (secret, public);
}
While it's work fine on macos
and ios
, I'm facing this error targeting chrome
with build-web
related to secp256k1
, probably a dependency of the third-party crate nostr
The following warnings were emitted during compilation:
warning: secp256k1-sys@0.10.1: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: secp256k1-sys@0.10.1: 1 error generated.
warning: secp256k1-sys@0.10.1: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: secp256k1-sys@0.10.1: 1 error generated.
error: failed to run custom build command for `secp256k1-sys v0.10.1`
…
warning: build failed, waiting for other jobs to finish...
Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
full command: cd "rust" && "cargo" "build" "--lib" "--target" "wasm32-unknown-unknown" "-Z" "build-std=std,panic_abort"
Is there a work-around ?
I also had trouble building on ios
and macos
using web_socket_channel but this has nothing to do with rust third-party package, it's a compatibility issue between flutter_rust_bridge
and web_socket_channel
Hi, that looks like a Rust compilation error. Thus maybe google / ask on the spcfici crate secp256k1-sys
, since this is not flutter_rust_bridge can control.
Close since this seems to be solved, but feel free to reopen if having any questions!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Is your feature request related to a problem? Please describe. Hey there, I love to see it getting more and more mature. I would like to start to use it on some projects but I'm facing "getting started" problem. The one-liner to generate a flutter app with some rust functions is great but when it comes to third parties libraries I feel lost. I've read various sections of the documentation but it miss step by step approach so we can step in without many doubts
Describe the solution you'd like
Describe what you've tried
cd rust
cargo add nostr
cd ..
flutter_rust_bridge_codegen generate
error:
Additional context I give here the example with the
nostr
third party package but I do not seek a specific answer for this, I'm looking for a more comprehensive way of using your tool his limits and how to work around.