IsolatedObject<T> constructor

IsolatedObject<T>(
  1. Factory<T> create, {
  2. bool keepIsolateAlive = true,
})

Spawns a dedicated isolate, constructs a T there via create, and returns immediately. Subsequent evaluate calls forward work to that isolate.

If keepIsolateAlive is true (the default), the parent isolate stays alive as long as this object is open, matching the usual service-style lifecycle. Set to false for fire-and-forget isolates that shouldn't block process shutdown on their own.

Implementation

IsolatedObject(Factory<T> create, {bool keepIsolateAlive = true})
  : _connected = _connect(create, keepIsolateAlive);