vincenzopalazzo / lampo.rs

lampo (lightning in Italian) is a experimental implementation of a tiny lightning node
http://lampo.devcrew.cc
BSD 3-Clause "New" or "Revised" License
39 stars 14 forks source link

flutter bindings #7

Closed vincenzopalazzo closed 1 year ago

vincenzopalazzo commented 1 year ago

Write the flutter bindings https://cjycode.com/flutter_rust_bridge/integrate.html

vincenzopalazzo commented 1 year ago

I think it is good to start here https://docs.flutter.dev/platform-integration/android/c-interop without add external tools

vincenzopalazzo commented 1 year ago

I play with it a little bit and I found that the following call is blocking

/// Allow to create a lampo deamon from a configuration patch!
#[no_mangle]
pub extern "C" fn lampo_listen(lampod: *mut LampoDeamon) {
    let Some(lampod) = as_rust!(lampod) else {
        panic!("errro during the convertion");
    };
    let _ = lampod.listen().map_err(|err| panic!("{err}"));
}

So I test can expose another struct like Worker, with the thread inside is, and when we stop the application we will call .join

This is an idea but I did not test it

vincenzopalazzo commented 1 year ago

Dart package is landing in https://github.com/dart-lightning/lampo.rs/pull/44

vincenzopalazzo commented 1 year ago

Fixed in https://github.com/dart-lightning/lampo.rs/pull/66

Demo in https://git.hedwing.dev/vincenzopalazzo/lampo-flutter