Свойство errors
Stream errorsВозвращает разделяемую по подписке стрим неперехваченных ошибок из изолированного процесса.
Каждая ошибка предоставляется как событие ошибки в стриме.
Фактический объект ошибки и стек-трейсы не обязательно будут такими же типами объектов, как в реальном изолированном процессе, но они всегда будут иметь одинаковый результат Object.toString.
Этот стрим основан на addErrorListener и removeErrorListener.
Исходный код
Stream get errors {
StreamController controller;
RawReceivePort port;
void handleError(message) {
String errorDescription = message[0];
String stackDescription = message[1];
var error = new RemoteError(errorDescription, stackDescription);
controller.addError(error, error.stackTrace);
}
controller = new StreamController.broadcast(
sync: true,
onListen: () {
port = new RawReceivePort(handleError);
this.addErrorListener(port.sendPort);
},
onCancel: () {
this.removeErrorListener(port.sendPort);
port.close();
port = null;
});
return controller.stream;
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-isolate/Isolate/errors.html