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

Cannot implement custom async runtime

TaeHagen opened this issue · comments

Describe the bug

According to the docs, in v2 you should be able to implement your own BaseAsyncRuntime. However, I created a struct that implements it, but it is never called. I think I need to declare a new executor, but there appears to be no way to access all the types I need to do that because many of them are not exported. How can I provide a custom async runtime? I need to manage it's lifecycle outside of the context of this project for background work when the dart VM is not active.

Thank you!

Steps to reproduce

Hint: A simple way to reproduce is to clone and modify the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/dart_minimal example package according to your needs.

  1. ...
  2. ...
  3. ...

Logs

None applicable

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

2.0

Flutter info

No response

Version of clang++

No response

Additional context

No response

Hi! Thanks for opening your first issue here! 😄

I think I need to declare a new executor, but there appears to be no way to access all the types I need to do that because many of them are not exported

Hmm then that looks like a bug! Feel free to PR to fix it (export needed variables), or alternatively I will fix it in the (hopefully within a week) next batch.

P.S. #1848 is also working on async runtime

Could I instead change the DefaultExecutor type to have another type parameter, one for the async runtime?

Sure, you are free to use whatever executor you like.