somehow_i_manage

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

somehow i manage

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

Pausing work
Inter Isolate communication

Getting started #
Add the package to your project by using this command
dart pub add somehow_i_manage
copied to clipboard
Usage #
To use this package create a worker like so
IWorker worker = IWorker.create(name: "name");
copied to clipboard
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");

copied to clipboard
Do not forget to dispose the worker when done using it
IWorker iWorker = await IWorker.create("create-test");

//computation here

iWorker.dispose();
copied to clipboard
This makes it easy to spawn Isolates and keep them alive for future jobs
Additional information #
Contributions are welcome

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.