spawn static method

Future<IsolateSupervisor> spawn(
  1. MultiIsolateServer multiIsolateServer,
  2. FutureOr<void> spawn(
    1. SendPort?
    ),
  3. int identifier
)

Implementation

static Future<IsolateSupervisor> spawn(
  MultiIsolateServer multiIsolateServer,
  FutureOr<void> Function(SendPort?) spawn,
  int identifier,
) async {
  var receivePort = ReceivePort();
  var sendPort = receivePort.sendPort;

  var isolate = await Isolate.spawn<SendPort>(spawn, sendPort, //
      paused: true,
      onExit: sendPort,
      onError: sendPort,
      debugName: 'server/$identifier');

  return IsolateSupervisor(multiIsolateServer, isolate, receivePort);
}