setError method

void setError(
  1. Object error, [
  2. StackTrace? stackTrace
])

Manually set error state with enhanced error info

Implementation

void setError(Object error, [StackTrace? stackTrace]) {
  final rxError = error is RxException
      ? error
      : RxException.withTimestamp(
          'Manual error set',
          originalError: error,
          stackTrace: stackTrace,
        );

  value = AsyncSnapshot.withError(
    ConnectionState.done,
    rxError,
    stackTrace ?? StackTrace.current,
  );
}