Skip to content

Commit

Permalink
chore: refactored Isolate.spawn logic to make sure we are closing a…
Browse files Browse the repository at this point in the history
…fter execution
  • Loading branch information
jerson committed Apr 24, 2023
1 parent 3a57800 commit 7345ee4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.5.7

- Refactored `Isolate.spawn` logic to make sure we are closing after execution

## 3.5.6

- Added support to linux ARM64 devices
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.5.6"
version: "3.5.7"
ffi:
dependency: transitive
description:
Expand Down
13 changes: 4 additions & 9 deletions lib/bridge/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,14 @@ class Binding {
final port = ReceivePort();
final args = IsolateArguments(name, payload, port.sendPort);

Isolate.spawn<IsolateArguments>(
callBridge,
args,
onError: port.sendPort,
onExit: port.sendPort,
);
final isolate = await Isolate.spawn(callBridge, args);

Completer<Uint8List> completer = new Completer();

StreamSubscription? subscription;
subscription = port.listen((message) async {
await subscription?.cancel();
port.listen((message) async {
completer.complete(message);
port.close();
isolate.kill();
});
return completer.future;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: fast_rsa
description: library for use RSA with support for android and ios, macOS, linux, windows and web
version: 3.5.6
version: 3.5.7
homepage: https://github.com/jerson/flutter-rsa

environment:
Expand Down

0 comments on commit 7345ee4

Please sign in to comment.