shekohex / allo-isolate

Run Multithreaded Rust along with Dart VM (in isolate) 🌀
Apache License 2.0
120 stars 18 forks source link

Is there any way to run a Rust function on Dart VM shutdown? #50

Closed temeddix closed 1 year ago

temeddix commented 1 year ago

I have some resources such as databases on the Rust side. When Dart VM gets shut down, perhaps because the user closed the Flutter app, the Rust finalizer functions that destroy Rust resources should be run.

Is this possible with allo-isolate, or can be made possible with a PR?

shekohex commented 1 year ago

If there a way to do some actions/lifecycle-hooks when the user closes the flutter application then you can just call your rust function from there, I do not see any reason why that wouldn't work.

temeddix commented 1 year ago

I see, that would be the reasonable way to do handle shutdown. Thank you :)