rawAsync method
Reduces any Outcome chain to a single Async.
It provides a direct way to get a raw value while collapsing all failure and empty states into an Err.
Example
final result = await Async(() => 'hello').rawAsync().value; // Ok('hello')
final emptyResult = await Some(None<int>()).rawAsync().value; // Err(...)
Implementation
Async rawAsync() {
return Async(() async {
final value = await raw(
onErr: (err) => err,
onNone: () => Err('The Outcome resolved to a None (empty) state!'),
);
if (value is Err) {
throw value;
}
return value;
});
}