somehow_i_manage 1.1.4 copy "somehow_i_manage: ^1.1.4" to clipboard
somehow_i_manage: ^1.1.4 copied to clipboard

A dart package making working with Isolates easier and manageable. It supports interprocess communication

THis package helps it easier to work with threads i.e. Isolates to make task distribuion easier

Features #

  1. Pausing work
  2. Inter Isolate communication

Getting started #

Add the package to your project by using this command

dart pub add somehow_i_manage

Usage #

To use this package create a worker like so

IWorker worker = IWorker.create(name: "name");

You can add callbacks for receiving messages from isolates like below


IWorker iWorker = await IWorker.create("create-test", onReceiveMessage: (message, _) {
print("message received");
expect(message.tag, "Selfie");
});

IWorker iWorker2 = await IWorker.create("create-test-2", onReceiveMessage: (message, _) {
print("message received 2");
expect(message.tag, "Selfie");
});

iWorker.sendMessage(sendPort: iWorker2.messageSendPort, tag: "Selfie");
await Future.delayed(Duration(seconds: 1));
print("Sent message");

Do not forget to dispose the worker when done using it

IWorker iWorker = await IWorker.create("create-test");

//computation here

iWorker.dispose();

This makes it easy to spawn Isolates and keep them alive for future jobs

Additional information #

Contributions are welcome

1
likes
150
pub points
0%
popularity

Publisher

unverified uploader

A dart package making working with Isolates easier and manageable. It supports interprocess communication

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

logging

More

Packages that depend on somehow_i_manage