W3cubDocs

/Dart 2

onError method

void onError (Function handleError)

Replaces the error event handler of this subscription.

The handleError function must be able to be called with either one positional argument, or with two positional arguments where the seconds is always a StackTrace.

The handleError argument may be null, in which case further error events are considered unhandled, and will be reported to Zone.handleUncaughtError.

The provided function is called for all error events from the stream subscription.

This method replaces the current handler set by the invocation of Stream.listen, by calling asFuture, or by a previous call to onError.

Implementation

void onError(Function handleError);

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-async/StreamSubscription/onError.html