PackageTrack
Sign in Get early access

isolate_contactor

An easy way to create a new Isolate, keep it active and communicate with it (supports `Worker` and `WASM` on the Web platform).

4.2.0 27K downloads/mo #1917 most downloaded on pub.dev lamnhan066/isolate_contactor

What this package is like to depend on

Last release 2 years ago

no release in 18 months

Release timing varies

gaps range from 8 days to 9 months

Nearly every release is documented

notes for 27 of 30 stable releases

Nothing withdrawn

no release was ever pulled

5 years old

37 releases · first in 2021

0 releases in the last 12 months

see the full history below

Release timeline

37 releases · Nov 2021 to May 2024
2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 37
  1. 4.2.0 02 May 2024
    Release notes
    • Migrate to package:web from dart:html to support wasm.
    • Experiment: Able to send an initialized signal from the Isolate to the main app. The migration steps:
      • Step 1:

        • Advanced method:

          • Before:
          final channel = IsolateContactorController<double, List<double>>(params);
          channel.onIsolateMessage.listen((message) {
            channel.sendResult(add(message));
          });
          
          • After:
          final channel = IsolateContactorController<double, List<double>>(params);
          channel.onIsolateMessage.listen((message) {
            channel.sendResult(add(message));
          });
          
          channel.initialized(); // <--
          
        • Worker on the Web:

          • Before:
          main() {
            callbackToStream('onmessage', (html.MessageEvent e) {
              return js_util.getProperty(e, 'data');
            }).listen((message) async {
              jsSendMessage(add(message));
            });
          }    
          
          • After:
          main() async {
            // Do something sync or async here
            
            callbackToStream('onmessage', (html.MessageEvent e) {
              return js_util.getProperty(e, 'data');
            }).listen((message) async {
              jsSendMessage(add(message));
            });
          
            jsSendMessage(IsolateState.initialized.toJson()); // <--
          }
          
      • Step 2: Update the create and createOwnIsolate method:

        • Before:
        final isolate = await IsolateContactor.create(
          function, 
          workerName: 'function',
        );
        
        • After:
        final isolate = await IsolateContactor.create(
          function, 
          workerName: 'function',
          autoMarkAsInitialized: false, // <--
        );
        
    Open source →
  2. 4.2.0-rc.4 01 May 2024 pre-release

    Nothing published for this version

  3. 4.2.0-rc.3 30 Apr 2024 pre-release

    Nothing published for this version

  4. 4.2.0-rc.2 29 Apr 2024 pre-release

    Nothing published for this version

  5. 4.2.0-rc.1 29 Apr 2024 pre-release

    Nothing published for this version

  6. 4.1.0 25 Apr 2024
    Release notes
    • Use if (dart.library.io) instead of if (dart.library.html) for more compatible.
    • Deprecate the createOwnIsolate in favor of the createCustom.
    • Add typedefs: IsolateFunction, CustomIsolateFunction, IsolateConverter.
    • Remove worker folder.
    • The README is cleared and isn't maintained anymore. Read in the isolate_manager instead.
    Open source →
  7. 4.0.1 04 Apr 2024
    Release notes
    • Better way to check valid IsolateException.
    • Improve tests.
    Open source →
  8. 4.0.0 10 Jul 2023
    Release notes
    • Add sendResultError to IsolateContactorController to make it easier to send the Exception from the Isolate to main app.
    • IsolateException parameters are now Object and StackTrace.
    • Add parameter type as P and change return type to R.
    • Add return type as void to onDispose method.
    • Change isolateParams from dynamic to Object?.
    Open source →
  9. 4.0.0-rc.2 05 Jul 2023 pre-release

    Nothing published for this version

  10. 4.0.0-rc.1 05 Jul 2023 pre-release

    Nothing published for this version

  11. 3.0.0 14 May 2023
    Release notes
    • Bumped Dart sdk to >=2.18.0 <4.0.0.
    • Update error_function.js name in test.
    Open source →
  12. 2.1.0 30 Jan 2023
    Release notes
    • Support try-catch block for all platforms including Worker on Web.
    • Update worker.dart to support try-catch block.
    • Increase min SDK to 2.15.0.
    Open source →
  13. 2.1.0-PRE.1 26 Jan 2023 pre-release

    Nothing published for this version

  14. 2.0.2 14 Jan 2023
    Release notes
    • On Flutter >3.3.0 - @pragma('vm:entry-point') anotation must be added to all methods that you want to use for isolation. Read README for more information.
    • Add @pragma('vm:entry-point') to internal method.
    • Use stream_channel: ^2.1.0 to avoid conflicts with flutter_test.
    Open source →
  15. 2.0.2+1 25 Jan 2023
    Release notes
    • Improve pub scores.
    Open source →
  16. 2.0.1 15 Dec 2022
    Release notes
    • Update worker.dart script for the Worker.
    • Update README.
    Open source →
  17. 2.0.0 24 Jun 2022
    Release notes
    • NO BREAKING CHANGE
    • Add Worker for Web platform (real Isolate on Web). Read README for more details.
    Open source →
  18. 2.0.0+1 13 Oct 2022
    Release notes
    • Improve function & parameter headers
    • Update dependencies
    Open source →
  19. 1.7.0 23 Jun 2022
    Release notes
    • BREAKING CHANGE: Change parameter name from isolateParams to initialParams for createOwnIsolate.
    • Now you can get the initialParams when creating an own isolate:
    void isolateFunction(dynamic params) {
      var controller = IsolateContactorController(params, onDispose: () {});
      var initialParams = controller.initialParams;
      controller.onIsolateMessage.listen((message) {
        // Do your stuff here
      });
    }
    
    Open source →
  20. 1.6.1 22 Jun 2022
    Release notes
    • Added IsolateContactorException, throw it when error occurs on sendMessage method.
    • Return Future for dispose method.
    Open source →
  21. 1.6.0 21 Jun 2022
    Release notes
    • Now you can await for the result when using isolateContactor.sendMessage.
    • Improved README and Test.
    Open source →
  22. 1.5.1 12 Jun 2022

    Nothing published for this version

  23. 1.5.1+1 12 Jun 2022
    Release notes
    • Improved result parser.
    • Improved README for allowed return type version, Improved Test and Example.
    Open source →
  24. 1.5.0 11 Jun 2022

    Nothing published for this version

  25. 1.5.0+1 11 Jun 2022
    Release notes
    • Now you can add return type for the stream listener. Example:
    // `fibonacci` have `int` return type
    IsolateContactor<int> isolateContactor = await IsolateContactor.create(fibonacci);
    
    // `intEvent` will be `int` type
    isolateContactorFuture.onMessage.listen((intEvent) {
      // intEvent
    });
    
    // `fibonacci` have `int` return type
    int fibonacci(dynamic n) {
      if (n <= 2) return 1;
    
      int n1 = 0, n2 = 1, n3 = 1;
    
      for (int i = 2; i <= n; i++) {
        n3 = n1 + n2;
        n1 = n2;
        n2 = n3;
      }
    
      return n3.round();
    }
    
    • Add onDispose parameter to IsolateContactorController, this parameter allows you to add your own dispose method inside isolateFunction for .createOwnIsolate.
    Open source →
  26. 1.4.0 03 Jun 2022
    Release notes
    • Fixed issue in internalIsolateFunction makes this function run twice.
    Open source →
  27. 1.3.0 18 May 2022
    Release notes
    • Updated dependencies.
    • Improved function headers.
    Open source →
  28. 1.2.1 03 May 2022
    Release notes
    • Update dependencies
    • Update homepage
    • Cleanup
    Open source →
  29. 1.2.0 26 Nov 2021
    Release notes
    • Fixed issue with the restart method.
    • Cleanup and reformat internal code.
    • BREAKING CHANGE:
      • Temporarily removed the pause and resume methods.
      • The debugMode in the create() and createOwnIsolate() methods was refactored to named optional parameters.
    Open source →
  30. 1.2.0+1 29 Jan 2022
    Release notes
    • Update README
    Open source →
  31. 1.2.0+2 28 Feb 2022
    Release notes
    • Update homepage
    Open source →
  32. 1.1.0 20 Nov 2021

    Nothing published for this version

  33. 1.1.0+1 20 Nov 2021
    Release notes
    • Remove flutter dependencies to support dart native
    • Add a better description
    Open source →
  34. 1.0.0 18 Nov 2021
    Release notes
    • Support web platform with limited features. The package use Future to provide the same features to Isolate but it doesn't have pause, resume, restart methods. I'll try to bring the same action with Isolate as much as possible.
    • Support Future when creating build-in method. More information please read Readme.
    • BREAKING CHANGE:
      • Create your own isolate:

        Before:

        void isolateFunction(List<dynamic> params) {
          final channel = IsolateChannel.connectSend(params.last);
          channel.stream.listen((rawMessage) {
            final message = IsolateContactor.getMessage(rawMessage);
            if (message != null) {
              // Do more stuff here
        
              // Send the result to your [onMessage] stream
              channel.sendResult(add(message[0], message[1]));
            }
        }
        

        Now:

        void isolateFunction(dynamic params) {
          final channel = IsolateContactorController(params);
          channel.onIsolateMessage.listen((message) {
            // Do more stuff here
        
            // Send the result to your [onMessage] stream
            channel.sendResult(add(message[0], message[1]));
          });
        }
        
    Open source →
  35. 0.0.1 17 Nov 2021
    Release notes
    • Initial release
    Open source →
  36. 0.0.1+1 17 Nov 2021
    Release notes
    • Update description
    Open source →
  37. 0.0.1+2 17 Nov 2021
    Release notes
    • Update flutter version
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive