Well ive started to build an app with flutter using `ndk` pkg, seems to work ok but i would prefer to use the more performant version in rust with full event caching in local db, does nostr-sdk flutter bindings work in web too?

Reply to this note

Please Login to reply.

Discussion

The rust library for flutter compiles to wasm but I don't know how to pack and ship the flutter package for web. For the desktop and mobile platforms I use cargokit but it doesn't work for the web.

Ok interesting, its not that important its just that the current version does work in web because its all Dart pkgs, having web support is really just a nice-to-have since the goal is to build a mobile app

Nice, so I'll expose the database soon

Done, I've exposed the NostrDatabase, added some other Client method and released the v0.39 (tagged in the git repo, I can't publish it to pub.dev).

How do the bindings work? If i wanted to expose the profile metadata stuff?

I usually copy the stuff I already exposed in the UniFFI bindings and adapt it to the flutter_rust_bridge.

So, in the case of metadata stuff, I would copy and adapt this: https://github.com/rust-nostr/nostr/blob/d7a8372e28a5dd7e1ce02b725ee0b43c798e332f/bindings/nostr-sdk-ffi/src/protocol/nips/nip01.rs

To adapt it, I follow these docs https://cjycode.com/flutter_rust_bridge/ or I just check the other modules I already adapted. In short: replace the uniffi macros with `frb` and use the `Result` from anyhow. If a new module is added, it must be exported in the `lib/nostr_sdk.dart` file.