when<W> abstract method

W when<W>(
  1. W whenSuccess(
    1. S success
    ),
  2. W whenError(
    1. E error
    )
)

Return the result in one of these functions.

if the result is an error, it will be returned in whenError, if it is a success it will be returned in whenSuccess.

Implementation

W when<W>(
  W Function(S success) whenSuccess,
  W Function(E error) whenError,
);