withLatestFromResult<R> method
Map the current stream to a new Result
stream,
as combining it with another stream
.
Use mapSuccess
to map the current stream with the
given stream
to a new Result
stream.
Example:
Result<String> result = Stream.value(0).withLatestFromResult<String>(
Stream.value(Result.success('1')),
(value, resultValue) => '$value, $resultValue', //0, 1
);
Implementation
Stream<Result<R>> withLatestFromResult<R>(
Stream<Result<R>> stream,
R Function(E, R) mapSuccess, {
String? tag,
}) =>
withLatestFrom<Result<R>, Result<R>>(
stream,
(e, t) => t.mapResult((data) => mapSuccess(e, data), tag: tag),
);