map<T1> method

Result<T1> map<T1>(
  1. T1 mapper(
    1. T
    )
)

Maps this Result of type T to an ErrorWrapper of type T1 with the given mapper.

Implementation

Result<T1> map<T1>(T1 Function(T) mapper) {
  if (hasResult) {
    return Result.success(mapper(result()));
  }

  return Result<T1>.error(error ?? 'Error was not specified');
}