andThen<U, F> method

  1. @override
Result<U, F> andThen<U, F>(
  1. Result<U, F> f(
    1. T t
    )
)
override

Similar to map Except you must return a new Result.

This is useful for when you need to do a subsequent computation using the inner T value, but that computation might fail. Additionally, andThen is really useful as a tool to flatten a Result<Result<A, E2>, E1> into a Result<A, E2> (see example below).

@param f The function to apply to the current value

Implementation

@override
Result<U, F> andThen<U, F>(Result<U, F> Function(T t) f) => f(this.value);