Code Monkey home page Code Monkey logo

easy_isolate's People

Contributors

lubritto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

easy_isolate's Issues

Error: The argument type 'FutureOr <dynamic> Function ... can't be assigned to the parameter type 'FutureOr <dynamic> Function

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,

Worker.init.<anonymous closure>

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)

Kill a worker

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?

Disconnect an mqtt client from an isolate

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.