fold<U extends Object, F extends Object> method

Future<Result<U, F>> fold<U extends Object, F extends Object>(
  1. U ok(
    1. T
    ),
  2. F err(
    1. E
    )
)

Invoke either the ok or the err function based on the result.

This is a combination of the map() and mapErr() functions.

Implementation

Future<Result<U, F>> fold<U extends Object, F extends Object>(
  U Function(T) ok,
  F Function(E) err,
) =>
    then((result) => result.fold(ok, err));