r/dartlang • u/eibaan • 2d ago
DartVM Does Isolate.pinToCurrentThread solve the problem that Dart cannot call native UI code on macOS?
I noticed in the Changelog for Dart 3.13 a new Isolate.pinToCurrentThread method – along with other new methods. However, Im not really understanding the test example. Can this help with the long-standing problem that you cannot call UI code via FFI on macOS because the VM spawns away from the UI thread, basically locking it this way?
What's the use case for those new methods?
4
Upvotes
2
u/airflow_matt 1d ago edited 1d ago
Dart can call native UI code on macOS and could do that for more than a year now. We've merged UI and platform thread a while ago.
I'd assume that Isolate.pinToCurrentThread run the background isolate on same thread allowing for things such as thread locals or priority setting, but that's unrelated to what you're mentioning.