Closed Tienisto closed 1 day ago
Hmm what about
pub async fn create_stream(stream_sink: StreamSink<i32>) {
tokio::time::sleep(Duration::from_secs(1)).await;
let _ = stream_sink.add(42);
tokio::time::sleep(Duration::from_secs(1)).await;
stream_sink.add_error("Some Error".to_string())
}
Yeah, this fixed the problem! Maybe we should add a warning that the return value of a function with StreamSink
should be removed / has no usage
That looks reasonable, and feel free to PR for this! The simplest form may be just add a few lines to the doc.
Describe the bug
The following Rust function throws an
Unhandled Exception
in Dart/Flutter:Throws:
This is difficult to catch on Dart side:
Reproduction Repo: https://github.com/Tienisto/frb_stream_error
Steps to reproduce
Return
Err
in Rust that takes aStreamSink
Logs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of
clang++
No response
Additional context
No response