From 6e42902322d208887f35b11ec75a5818c00ddcec Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Thu, 10 Sep 2026 15:32:30 -0400 Subject: [PATCH] run GomuksInit on an Isolate Fixes #70 --- lib/controllers/client.dart | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/controllers/client.dart b/lib/controllers/client.dart index af44d2f..27c0646 100644 --- a/lib/controllers/client.dart +++ b/lib/controllers/client.dart @@ -49,15 +49,17 @@ import "package:path_provider/path_provider.dart"; class ClientController extends AsyncNotifier { @override Future build() async { - final Pointer root; - if (Platform.isAndroid || Platform.isIOS) { - final dir = await getApplicationSupportDirectory(); - root = "${dir.path}/gomuks".toNativeUtf8().cast(); - } else { - root = nullptr.cast(); - } + final handle = await Isolate.run(() async { + final Pointer root; + if (Platform.isAndroid || Platform.isIOS) { + final dir = await getApplicationSupportDirectory(); + root = "${dir.path}/gomuks".toNativeUtf8().cast(); + } else { + root = nullptr.cast(); + } - final handle = GomuksInit(root); + return GomuksInit(root); + }); final callable = NativeCallable<