spawnUriIsolate<T> function

Future<IsolateConnection> spawnUriIsolate<T>(
  1. Uri uri, {
  2. bool paused = false,
  3. bool errorsAreFatal = true,
  4. void onConnect(
    1. SendPort send
    )?,
  5. void onExit()?,
  6. void onError(
    1. String error,
    2. StackTrace stackTrace
    )?,
  7. String? debugName,
})

Helper function to spawn an isolate by URI

Implementation

Future<IsolateConnection> spawnUriIsolate<T>(
  Uri uri, {
  bool paused = false,
  bool errorsAreFatal = true,
  void Function(SendPort send)? onConnect,
  void Function()? onExit,
  void Function(String error, StackTrace stackTrace)? onError,
  String? debugName,
}) {
  return _spawnIsolate(
    onConnect: onConnect,
    onExit: onExit,
    onError: onError,
    spawn: (receivePort, controlPort) => Isolate.spawnUri(
      uri,
      [],
      receivePort.sendPort,
      paused: paused,
      errorsAreFatal: errorsAreFatal,
      onExit: controlPort.sendPort,
      onError: controlPort.sendPort,
      debugName: debugName,
    ),
  );
}