mapAsync<U> method
Implementation
Future<Result<U, E>> mapAsync<U>(Future<U> Function(T value) fn) async {
if (this is Ok<T, E>) {
try {
final result = await fn((this as Ok<T, E>).value);
return Ok(result);
} catch (e) {
return Err(e as E); // Cast carefully or handle the type properly.
}
}
return this as Result<U, E>;
}