errorToLce method

Stream<LceState<DATA>> errorToLce([
  1. DATA? errorData(
    1. Object error
    )?
])

Maps an upstream error to LceError errorData Evaluates data for error state

Implementation

Stream<LceState<DATA>> errorToLce([DATA? Function(Object error)? errorData]) => transform(
  StreamTransformer.fromHandlers(
    handleError: (error, stacktrace, sink) {
      sink.add(
          LceState.error(
            null != errorData ? errorData(error) : null,
            false,
            error is Exception ? error : Exception(error.toString())
          )
      );
    }
  )
);