fold<W> abstract method

W fold<W>(
  1. W onSuccess(
    1. S success
    ),
  2. W onFailure(
    1. F failure
    )
)

Returns the result of onSuccess for the encapsulated value if this instance represents Success or the result of onError function for the encapsulated value if it is Failure.

Implementation

W fold<W>(
  W Function(S success) onSuccess,
  W Function(F failure) onFailure,
);