isolate_executor 2.0.2+3

  • Readme
  • Changelog
  • Installing
  • 75

isolate_executor #

This library contains types that allow for executing code in a spawned isolate, perhaps with additional imports.

Subclass Executable and override its execute method. Invoke IsolateExecutor.executeWithType, passing in that subclass. The code in execute will run in another isolate. Any value it returns will be returned by IsolateExecutor.executeWithType.

A returned value must be a primitive type (anything that is encodable as JSON). You may pass parameters to the other isolate by providing a message map.


class Echo extends Executable {
  Echo(Map<String, dynamic> message)
      : echoMessage = message['echo'],

  final String echoMessage;

  Future<dynamic> execute() async {
    return echoMessage;

Future main() async {
    final result = await IsolateExecutor.executeWithType(Echo, message: {'echo': 'hello'});
    assert(result == 'hello');

Changelog #

2.0.1 #

  • Improve stack trace readability

2.0.0 #

  • Update for Dart 2

1.0.1 #

  • Fixes issue when used on Windows OS

1.0.0 #

  • Initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  isolate_executor: ^2.0.2+3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:isolate_executor/isolate_executor.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 19, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/src/executor.dart. (-6.31 points)

Analysis of lib/src/executor.dart reported 13 hints, including:

line 14 col 31: Unnecessary new keyword.

line 20 col 49: Unnecessary new keyword.

line 21 col 52: Unnecessary new keyword.

line 24 col 39: Unnecessary new keyword.

line 25 col 13: Unnecessary new keyword.

Fix lib/src/source_generator.dart. (-1.99 points)

Analysis of lib/src/source_generator.dart reported 4 hints:

line 6 col 1: 'package:analyzer/analyzer.dart' is deprecated and shouldn't be used.

line 21 col 19: Unnecessary new keyword.

line 54 col 22: 'parseDartFile' is deprecated and shouldn't be used. Please use parseFile2 instead.

line 58 col 10: Prefer to use whereType on iterable.

Fix lib/src/executable.dart. (-1.49 points)

Analysis of lib/src/executable.dart reported 3 hints:

line 14 col 32: Use = to separate a named parameter from its default value.

line 15 col 85: Unnecessary new keyword.

line 23 col 35: Unnecessary new keyword.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and isolate_executor.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer >=0.32.0 <0.50.0 0.39.4
Transitive dependencies
_fe_analyzer_shared 1.0.3
args 1.5.2
async 2.4.0
charcode 1.1.2
collection 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
glob 1.2.0
html 0.14.0+3
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
path 1.6.4
pedantic 1.9.0
pub_semver 1.4.2
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
watcher 0.9.7+13
yaml 2.2.0
Dev dependencies
test ^1.3.0