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

Question about flutter `Isolate`

guchengxi1994 opened this issue · comments

I was using Isolate to upload files with v1.82.6 and it worked fine. But after I upgrade frb to 2.0.0.dev.21, when I use Isolate, it throws
should init Rustlib. I have inited RustLib in main function. I have 2 questions.

  1. should I init RustLib everytime in a new Isolate?
  2. should I dispose RustLib after works done in Isolate?

Good question - I should add the multi-isolate scenario in the tests and in the doc. Before that, here is my quick guess: Try to init in new isolate. As for disposal, it would be great to do; if it is not disposed, I am not sure whether dart isolate cleanup is smart enough or not to cleanup all related dart resources. Anyway, it seems to be a common style to dispose() everything in Flutter (e.g. dispose ui.Image, widget controllers, etc)

I see. Thanks for the answer.

You are welcome!