fold<W> method

  1. @override
W fold<W>(
  1. W onSuccess(
    1. S success
    ),
  2. W onFailure(
    1. F error
    )
)
override

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

@override
W fold<W>(
  W Function(S success) onSuccess,
  W Function(F error) onFailure,
) {
  return onSuccess(_success);
}