error method

  1. @override
void error(
  1. Object error,
  2. StackTrace stackTrace
)
override

Pass an error to the observer.

Implementation

@override
void error(Object error, StackTrace stackTrace) {
  DisposedError.checkNotDisposed(this);
  if (_hasStopped) {
    return;
  }
  _hasStopped = true;
  _hasError = true;
  _error = error;
  _stackTrace = stackTrace;
  for (final observer in [..._observers]) {
    observer.error(error, stackTrace);
  }
  _observers.clear();
}