ResStream<S, F>.fail constructor

ResStream<S, F>.fail(
  1. F value, [
  2. Object? exception,
  3. StackTrace? stack
])

Creates a result stream that emits one failure with the given value and an optional exception and stack trace, then closes. For stubbing in tests:

when(() => weatherApi.watchTemperature(any()))
    .thenReturn(ResultStream.fail(WeatherError.offline));

Implementation

ResStream.fail(F value, [Object? exception, StackTrace? stack])
  : this._(t.ResultStream.fail(value, exception, stack));