spawn<T> static method

Future<Isolate> spawn<T>(
  1. void entryPoint(
    1. T message
    ),
  2. T message, {
  3. bool paused = false,
  4. bool errorsAreFatal = true,
  5. SendPort? onExit,
  6. SendPort? onError,
  7. String? debugName,
  8. @internal Hub? hub,
})

Calls Isolate.spawn with an error listener from the Sentry SDK.

Providing your own onError will not add the listener from Sentry SDK.

Implementation

static Future<Isolate> spawn<T>(
  void Function(T message) entryPoint,
  T message, {
  bool paused = false,
  bool errorsAreFatal = true,
  SendPort? onExit,
  SendPort? onError,
  String? debugName,
  @internal Hub? hub,
}) async {
  return Isolate.spawn(
    entryPoint,
    message,
    paused: paused,
    errorsAreFatal: errorsAreFatal,
    onExit: onExit,
    onError: onError ?? createPort(hub ?? HubAdapter()).sendPort,
    debugName: debugName,
  );
}