Replies: 1 comment
-
That looks interesting! I guess the more general form of this proposal is like, "exposing methods defined on opaque types". We already understand methods defined on non-opaque types https://cjycode.com/flutter_rust_bridge/feature/lang_methods.html. So does this work on opaque types? (or with minor modifications?) cc @rogurotus who implemented the great opaque types |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Having learned about RustOpaque, I wanted to sandbox a bit and see what it was all about. I wrote
api_sandbox.rs
.I was hopeful that
RustOpaque<fn(i32) -> i32>
would result in a callable Dart type.It doesn't seem to be callable, but hey it's called "Opaque" for a reason. I can write this, however.
Then in Dart,
I think flutter_rust_bridge could generate these helpers and make invocation transparent to callers. But why stop there? Since Dart supports getter and setter functions, all the fields and methods could be exposed on a "by reference" object, though probably best kept as a separate feature from
RustOpaque
. If very tightly integrated, it could do this to all non-serializable values by default, without any explicit encapsulation:I'm thinking of attempting it myself (just fn to start), but I wanted to reach out and ask if this has already been tried and if there's any standing knowledge on the feasibility. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions