StreamResultX<T> extension

Extensions for working with streams of Result values without unwrapping each event manually.

on

Properties

dataStream Stream<T>

Available on Stream<Result<T>>, provided by the StreamResultX extension

Emits only the Success events, unwrapped to their data.
no setter

Methods

listenResult({required void onData(T data), required void onError(Failure failure), void onDone()?, bool? cancelOnError}) StreamSubscription<Result<T>>

Available on Stream<Result<T>>, provided by the StreamResultX extension

Convenience for subscribing with separate success and error callbacks.
mapStream<R>(R transform(T data)) Stream<Result<R>>

Available on Stream<Result<T>>, provided by the StreamResultX extension

Maps each successful event with transform, leaving errors untouched.
whereError() Stream<Result<T>>

Available on Stream<Result<T>>, provided by the StreamResultX extension

Emits only the Error events as full Results.
whereSuccess() Stream<Result<T>>

Available on Stream<Result<T>>, provided by the StreamResultX extension

Emits only the Success events as full Results. Useful when you want to keep the result wrapper for downstream chaining.