map<U> method
Maps the value if successful, otherwise returns the error as is.
Implementation
Result<U, E> map<U>(U Function(T value) f) {
if (this is Success<T, E>) {
return Result.ok(f((this as Success<T, E>).value));
}
return Result.error((this as Failure<T, E>).error);
}