transf<R extends Object> method
Transforms the Outcome's generic type from T
to R
.
Uses the transformer function noFutures
if provided, otherwise
attempts a direct cast.
Implementation
@override
Result<Option<R>> transf<R extends Object>([
@noFutures R Function(T e)? noFutures,
]) {
try {
final value0 = UNSAFE(() => unwrap());
final value1 = noFutures?.call(value0) ?? value0 as R;
return Ok(Option.from(value1));
} catch (error, stackTrace) {
assert(false, error);
return Err('Cannot transform $T to $R', stackTrace: stackTrace);
}
}