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 runner) {

// This registers a function to be run _inside_ the newly spawned isolate, Level.INFO);

_setupLogging(Level info) {

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

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

Runner runner = await =>  builder
  ..autoclose = true
  ..debugName = "processor"
  ..poolSize = 3

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