Observer<T> constructor

Observer<T>({
  1. NextCallback<T>? next,
  2. ErrorCallback? error,
  3. CompleteCallback? complete,
  4. bool ignoreErrors = false,
})

An observer with custom handlers:

  • next is a callback that is called zero or more times with values of type T.
  • error is a callback that is called when the observer terminates with an exception and an optional stack trace. If you do not provide an this callback the error is passed to the defaultErrorHandler, unless ignoreErrors is set to true.
  • complete is a callback that is called when the observer successfully terminates.

Implementation

factory Observer({
  NextCallback<T>? next,
  ErrorCallback? error,
  CompleteCallback? complete,
  bool ignoreErrors = false,
}) =>
    BaseObserver<T>(
        next ?? emptyFunction1,
        error ?? (ignoreErrors ? emptyFunction2 : defaultErrorHandler),
        complete ?? emptyFunction0);