isolate_service 0.4.7

  • Readme
  • Changelog
  • Installing
  • 25

isolate_service #

pub package Coverage Status

A flutter package that uses the isolate package, and adds some convenience for working with isolates in Flutter. Isolates spawned with this library will be automatically destroyed and recreated when using hot-restart in Flutter. This library does not allow the use of Flutter plugins within isolates.

Getting Started #

You can register initialization globally, so that all isolates spawned using the library will run the same initialization


// This runs whenever an `IsolateRunner` is spawned - this runs in the spawning isolate, so it accepts
// closures
RunnerFactory.global.onIsolateCreated((IsolateRunner runner) {
    
});

// This registers a function to be run _inside_ the newly spawned isolate
RunnerFactory.global.addIsolateInitializer(_setupLogging, Level.INFO);

_setupLogging(Level info) {
...
}

/// Instead of registering globally, you can create your own custom factory
final customFactory = RunnerFactory()
    ..addIsolateInitializer(_setupLogging, Level.INFO)
    ..onIsolateCreated(...);

To spawn an isolate Runner, call the spawn method on RunnerFactory


Runner runner = await RunnerFactory.global.spawn((builder) =>  builder
  ..autoclose = true
  ..debugName = "processor"
  ..poolSize = 3
);

By default, any spawned Runner instances will be automatically closed when the parent Isolate terminates.

[0.4.7] #

  • Error handling

[0.4.6] #

  • Bug fixes

[0.4.4] #

  • Initial release

Use this package as a library

1. Depend on it

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


dependencies:
  isolate_service: ^0.4.7

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter 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_service/isolate_service.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
--
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
--
Overall:
Weighted score of the above. [more]
25
Learn more about scoring.

This package is not analyzed, because it is discontinued.

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

exitCode: 255 stdout: parsing /tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_service.dart... parsing /tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_factory.dart... parsing /tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/isolate_service.dart... parsing /tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/isolate_spawner.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/collection/collection.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/developer/developer.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/internal/internal.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/interceptors.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/io/io.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/isolate/isolate.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/convert/convert.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/async/async.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/typed_data/typed_data.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_empty.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/js_util/js_util_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/html/html_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/math/math.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/core/core.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_http/http.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/ui/ui.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/js/js_dart2js.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/ffi/ffi.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/wasm/wasm.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/isolate.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/isolate_runner.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/ports.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/src/util.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/runner.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/load_balancer.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/src/errors.dart... parsing /tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/registry.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_array.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_number.dart... parsing /flutter/bin/cache/pkg/sky_engine/lib/_interceptors/js_string.dart... Initialized dartdoc with 34 libraries in 28.7 seconds documenting isolate_service Generating docs for library isolate_service from package:isolate_service/runner_factory.dart... Generating docs for library isolate_service from package:isolate_service/isolate_service.dart... Generating docs for library isolate_spawner from package:isolate_service/isolate_spawner.dart... Generating docs for library runner_service from package:isolate_service/runner_service.dart... Validating docs... Documented 4 public libraries in 1.5 seconds stderr: Documenting isolate_service... warning: isolate_service has no library level documentation comments, from isolate_service: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_factory.dart:1:9) warning: no canonical library found for isolate_service.RunnerBuilder.hashCode, not linking, from isolate_service.RunnerBuilder.hashCode: (file:///flutter/bin/cache/pkg/sky_engine/lib/core/object.dart:94:20) warning: no canonical library found for isolate_service.RunnerBuilder.runtimeType, not linking, from isolate_service.RunnerBuilder.runtimeType: (file:///flutter/bin/cache/pkg/sky_engine/lib/core/object.dart:116:21) warning: no canonical library found for isolate_service.RunnerBuilder.noSuchMethod, not linking, from isolate_service.RunnerBuilder.noSuchMethod: (file:///flutter/bin/cache/pkg/sky_engine/lib/core/object.dart:111:20) warning: no canonical library found for isolate_service.RunnerBuilder.toString, not linking, from isolate_service.RunnerBuilder.toString: (file:///flutter/bin/cache/pkg/sky_engine/lib/core/object.dart:99:19) warning: no canonical library found for isolate_service.RunnerBuilder.==, not linking, from isolate_service.RunnerBuilder.==: (file:///flutter/bin/cache/pkg/sky_engine/lib/core/object.dart:62:26) warning: isolate_service has no library level documentation comments, from isolate_service: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/isolate_service.dart:1:9) error: failed to write file at: isolate_service/isolate_service-library.html for symbol isolate_service: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/isolate_service.dart:1:9) conflicting with file already generated by isolate_service: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_factory.dart:1:9) Dartdoc generates a path and filename to write to for each symbol. isolate_service conflicts with another symbol in the generated path, and therefore can not be written out. Changing the name, library name, or class name (if appropriate) of one of the conflicting items can resolve the conflict. Alternatively, use the @nodoc tag in one symbol's documentation comments to hide it. warning: unresolved doc reference [SendPort] from runner_service.IsolateService.run: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_service.dart:53:13) in documentation inherited from isolate.runner.Runner.run: (file:///tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/runner.dart:38:13) warning: unresolved doc reference [Isolate.spawn] from runner_service.IsolateService.run: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_service.dart:53:13) in documentation inherited from isolate.runner.Runner.run: (file:///tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/runner.dart:38:13) warning: unresolved doc reference [TimeoutException] from runner_service.IsolateService.run: (file:///tmp/pub-dartlang-dartdocZSOPVM/pkg/lib/runner_service.dart:53:13) in documentation inherited from isolate.runner.Runner.run: (file:///tmp/pub-cache-dirGBEBMN/hosted/pub.dartlang.org/isolate-2.0.3/lib/runner.dart:38:13) found 10 warnings and 1 error Unhandled exception: dartdoc encountered 1 errors while processing. #0 Dartdoc.generateDocs (package:dartdoc/dartdoc.dart:202:7)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.6.0 <3.0.0