addSentryErrorListener method

RawReceivePort addSentryErrorListener({
  1. @internal Hub? hub,
})

Calls addErrorListener with an error listener from the Sentry SDK. Store the returned RawReceivePort if you want to remove the Sentry listener again.

Since isolates run concurrently, it's possible for it to exit before the error listener is established. To avoid this, start the isolate paused, add the listener and then resume the isolate.

Implementation

RawReceivePort addSentryErrorListener({@internal Hub? hub}) {
  final port = SentryIsolate.createPort(hub ?? HubAdapter());
  addErrorListener(port.sendPort);
  return port;
}