Compare commits

..
Author SHA1 Message Date
d308ef98cb
small fixups
Fixes #67
2026-10-15 15:13:31 -04:00
f082a75d9c
run GomuksStart on an isolate 2026-10-15 14:25:45 -04:00
4 changed files with 14 additions and 3 deletions

View file

@ -65,7 +65,7 @@ When possible, use immutable collections instead of the mutable equivalent. For
When possible, we prefer not to create global variables or methods. You can usually replace a global variable with a Riverpod controller, and a global method with an extension method.
I'm also not a big fan of private methods or variables, but this is contextual.
I'm also not a big fan of unneeded private methods or variables, but this is contextual.
### Modern Dart syntax

2
gomuks

@ -1 +1 @@
Subproject commit 38e5033c3a91db0cbea6cbd9f0feef9ff6441038
Subproject commit ad275f7613894d9d2fa4d16d733a6816e2978de9

View file

@ -1,5 +1,6 @@
import "dart:async";
import "dart:ffi";
import "dart:isolate";
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:flutter/foundation.dart";
@ -112,12 +113,20 @@ class GomuksListenerController extends AsyncNotifier<void> {
ref.onDispose(callable.close);
final errorCode = GomuksStart(handle, callable.nativeFunction);
final errorCode = await _start(handle, callable.nativeFunction);
if (errorCode != 0) {
throw Exception("GomuksStart returned error code $errorCode");
}
}
static Future<int> _start(
int handle,
Pointer<
NativeFunction<Void Function(Pointer<Char>, Int64, GomuksOwnedBuffer)>
>
callback,
) => Isolate.run(() => GomuksStart(handle, callback));
static final provider = AsyncNotifierProvider<GomuksListenerController, void>(
GomuksListenerController.new,
);

View file

@ -5,6 +5,7 @@ import "package:flutter/foundation.dart";
import "package:flutter_riverpod/flutter_riverpod.dart";
import "package:material_emoji_picker/material_emoji_picker.dart";
import "package:media_kit/media_kit.dart";
import "package:nexus/controllers/client.dart";
import "package:nexus/controllers/client_state.dart";
import "package:nexus/controllers/gomuks_listener.dart";
import "package:nexus/controllers/key.dart";
@ -193,6 +194,7 @@ class const App({super.key}) extends StatelessWidget {
AsyncError(:final error, :final stackTrace) => ErrorDialog(
error,
stackTrace,
provider: ClientController.provider,
),
},
),