lubritto / easy_isolate Goto Github PK
View Code? Open in Web Editor NEWAn abstraction of isolates providing an easy way to work with different threads
Home Page: https://pub.dev/packages/easy_isolate
License: Apache License 2.0
An abstraction of isolates providing an easy way to work with different threads
Home Page: https://pub.dev/packages/easy_isolate
License: Apache License 2.0
Hi, I am in the process of learning to use Parallel.run but I am running into a problem. I get the error:
Error: The argument type 'FutureOr <dynamic> Function ({int? Test})' can't be assigned to the parameter type 'FutureOr <dynamic> Function ({dynamic item})'.
Apart from the argument, the signature seems to be the same.
My idea is that clicking a button triggers a Parallel.run that works on a local database.
My Function:
FutureOr<dynamic> processWork ({int? Test} async { ... return 0; }
I call her in an ElevatedButton
ElevatedButton (
onPressed: oisvc.getExportJsonsToEmail,
...
and getExportJsonSToEmail is of the form
Future<void> getExportJsonsToEmail () async { final result = await Parallel.run ( processWork, // entryValue: 1, ); log ('result: $ result'); }
Whether I integrate the processWork function inside the static class or outside the class I always get a similar error.
I tested like the example void isOven by putting void processWork. And that's where my disappointments started.
Can you update the doc to use the static Parallel.run method to give a working example please?
Best regards,
E/flutter ( 3491): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Invalid argument(s): Illegal argument in isolate message: (object extends NativeWrapper - Library:'dart:io' Class: _NativeSocket@13069316)
E/flutter ( 3491): #0 _SendPortImpl._sendInternal (dart:isolate-patch/isolate_patch.dart:249:43)
E/flutter ( 3491): #1 _SendPortImpl.send (dart:isolate-patch/isolate_patch.dart:230:5)
E/flutter ( 3491): #2 Worker.init. (package:easy_isolate/src/worker.dart:123:28)
E/flutter ( 3491): #3 Worker.init. (package:easy_isolate/src/worker.dart:117:29)
E/flutter ( 3491): #4 _rootRunUnary (dart:async/zone.dart:1444:13)
E/flutter ( 3491): #5 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 3491): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter ( 3491): #7 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter ( 3491): #8 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter ( 3491): #9 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
E/flutter ( 3491): #10 _StreamController._add (dart:async/stream_controller.dart:607:7)
E/flutter ( 3491): #11 _StreamController.add (dart:async/stream_controller.dart:554:5)
E/flutter ( 3491): #12 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
I have a process that I carry out in a worker that I want to be done infinitely until I change the page.
I had thought about killing the worker so that his loopEvent ends as well.
How do you kill a worker?
Hi, I have created a client on an isolate. When I do worker.dispose (), the client keeps receiving data from the mqtt server until it disconnects (when receiving a lot of data, even though I kill the worker, I keep receiving the data that has been queued, so when I kill the worker I keep receiving data).
But I would like to be able to disconnect him, without waiting for him to disconnect. Can I send a message to the worker to disconnect it? How does the worker work when I send it several messages, I mean, does the isolate method run again?
Sorry for the inconvenience.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.