(rust call dart) DartFn does not support return types except `DartFnFuture<T>` yet
mdddj opened this issue · comments
mddd 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
fzyzcjy commented
Yes, it needs to return a future, because otherwise your thread will be blocked waiting for that call, which may not not very efficient.