fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.

Home Page:https://fzyzcjy.github.io/flutter_rust_bridge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(rust call dart) DartFn does not support return types except `DartFnFuture<T>` yet

mdddj opened this issue · comments

commented

example

pub async fn test(on_complete : impl Fn() -> ()) {
    on_complete()
}

run flutter_rust_bridge_codegen generate

[0.6s] Parse
  └── [0.5s] Run cargo expand
  └── [0.1s] Parse source graph                                                                                           Error: function=Ident { sym: test, span: bytes(1807..1811) }

Caused by:
    0: when trying to parse DartFn
    1: DartFn does not support return types except `DartFnFuture<T>` yet

version:flutter_rust_bridge_codegen 2.0.0-dev.28

Yes, it needs to return a future, because otherwise your thread will be blocked waiting for that call, which may not not very efficient.