void addErrorListener(SendPort port)

Requests that uncaught errors of the isolate are sent back to port.

The errors are sent back as two elements lists. The first element is a String representation of the error, usually created by calling toString on the error. The second element is a String representation of an accompanying stack trace, or null if no stack trace was provided. To convert this back to a StackTrace object, use StackTrace.fromString.

Listening using the same port more than once does nothing. A port will only receive each error once, and will only need to be removed once using removeErrorListener.

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.

Source

external void addErrorListener(SendPort port);