mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-01-11 22:40:36 +00:00
refactor: replace await for loop with listen for message handling
This commit is contained in:
parent
405c3d8e35
commit
26362fe556
1 changed files with 3 additions and 4 deletions
|
|
@ -68,8 +68,7 @@ class ImageCropIsolate {
|
|||
|
||||
final receivePort = ReceivePort();
|
||||
mainSendPort.send(receivePort.sendPort);
|
||||
|
||||
await for (var message in receivePort) {
|
||||
receivePort.listen((message) async {
|
||||
if (message is Map<String, dynamic>) {
|
||||
try {
|
||||
final imageBytes = message['imageBytes'] as Uint8List;
|
||||
|
|
@ -84,9 +83,9 @@ class ImageCropIsolate {
|
|||
}
|
||||
} else if (message == 'dispose') {
|
||||
RustLib.dispose();
|
||||
break;
|
||||
receivePort.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<Uint8List?> process(Uint8List imageBytes) async {
|
||||
|
|
|
|||
Loading…
Reference in a new issue