working message rendering

This commit is contained in:
Henry Hiles 2026-01-28 14:17:18 +00:00
commit 7c76bb6e66
No known key found for this signature in database
20 changed files with 305 additions and 197 deletions

View file

@ -4,7 +4,7 @@ import "dart:typed_data";
import "package:ffi/ffi.dart";
import "package:nexus/src/third_party/gomuks.g.dart";
extension GomuksOwnedBufferToJson on GomuksOwnedBuffer {
extension GomuksOwnedBufferToX on GomuksOwnedBuffer {
Uint8List toBytes() {
try {
if (base == nullptr || length <= 0) return Uint8List(0);
@ -14,14 +14,7 @@ extension GomuksOwnedBufferToJson on GomuksOwnedBuffer {
}
}
Map<String, dynamic> toJson() {
final bytes = toBytes();
if (bytes.isEmpty) return {};
final json = jsonDecode(utf8.decode(bytes));
if (json is Map<String, dynamic>?) return json ?? {};
throw json;
}
dynamic toJson() => jsonDecode(utf8.decode(toBytes()));
}
extension JsonToGomuksBuffer on Map<String, dynamic> {