run GomuksInit on an Isolate

Fixes #70
This commit is contained in:
Henry Hiles 2026-09-10 15:32:30 -04:00
commit 6e42902322
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -49,15 +49,17 @@ import "package:path_provider/path_provider.dart";
class ClientController extends AsyncNotifier<int> { class ClientController extends AsyncNotifier<int> {
@override @override
Future<int> build() async { Future<int> build() async {
final Pointer<Char> root; final handle = await Isolate.run(() async {
if (Platform.isAndroid || Platform.isIOS) { final Pointer<Char> root;
final dir = await getApplicationSupportDirectory(); if (Platform.isAndroid || Platform.isIOS) {
root = "${dir.path}/gomuks".toNativeUtf8().cast(); final dir = await getApplicationSupportDirectory();
} else { root = "${dir.path}/gomuks".toNativeUtf8().cast();
root = nullptr.cast(); } else {
} root = nullptr.cast();
}
final handle = GomuksInit(root); return GomuksInit(root);
});
final callable = final callable =
NativeCallable< NativeCallable<