Iso constructor

Iso(
  1. void runFunction(
    1. IsoRunner
    ), {
  2. IsoOnData? onDataOut,
  3. IsoOnData? onError,
})

If onDataOut is not provided the data coming from the isolate will print to the screen by default

Implementation

Iso(this.runFunction, {this.onDataOut, this.onError})
    : _fromIsolateReceivePort = ReceivePort(),
      _fromIsolateErrorPort = ReceivePort() {
  onDataOut ??= (dynamic data) => null;
  onError ??=
      (dynamic err) => throw IsolateRuntimeError("Error in isolate:\n $err");
}