Replies: 1 comment
-
You are welcome! old answer it seems there can be e.g. a vec of streams https://cjycode.com/flutter_rust_bridge/guides/types/translatable/stream#stream-argument-in-arbitrary-types btw, this may be useful https://cjycode.com/flutter_rust_bridge/guides/direction/rust-call-dart EDIT: oh I understand your question now. It is because, one StreamSink will have one target Dart location to send things to. It is possible to extend the logic, and feel free to PR for that if needed. However, maybe one way is to just get the stream from Dart side. Could you please elaborate a bit why the stream needs to be gotten from Rust? Maybe we can discuss how to workaround it. (e.g. a naive way - make a dart wrapper class that stores the stream) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am really enjoying the experience of Flutter Rust Bridge, and thank you for the great library.
However, I have a question regarding the
Stream
-StreamSink
API.As far as I went through the code and docs, it seems like calling
frb
function withStreamSink
argument is pretty much the only way to passStream
to dart-side.In many cases, I can pass around generate stream in dart, but sometime, I must get it from rust code directly.
This results creating brand new
Stream
-StreamSink
every time, and enforcing rust to keepVec
ofStreamSink
which is not so efficient.So, it is true that there is no way to pass a
Stream
to dart connected with existingStreamSink
in rust?Is this an actual limitation by design?
Beta Was this translation helpful? Give feedback.
All reactions