shekohex / allo-isolate

Run Multithreaded Rust along with Dart VM (in isolate) 🌀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

temeddix opened this issue · comments

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?

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.

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