errorCallback abstract method
- Object error,
- StackTrace? stackTrace
Intercepts errors when added programmatically to a Future or Stream.
When calling Completer.completeError, StreamController.addError, or some Future constructors, the current zone is allowed to intercept and replace the error.
Future constructors invoke this function when the error is received directly, for example with Future.error, or when the error is caught synchronously, for example with Future.sync.
There is no guarantee that an error is only sent through errorCallback once. Libraries that use intermediate controllers or completers might end up invoking errorCallback multiple times.
null if no replacement is desired. Otherwise returns an instance
of AsyncError holding the new pair of error and stack trace.
Custom zones may intercept this operation.
Implementations of a new asynchronous primitive that converts synchronous errors to asynchronous errors rarely need to invoke errorCallback, since errors are usually reported through future completers or stream controllers.
AsyncError? errorCallback(Object error, StackTrace? stackTrace);