getSuccess method

R getSuccess()

Implementation

R getSuccess() {
  return switch (this) {
    Success<L, R>(value: final r) => r,
    Failure<L, R>() => throw StateError('Cannot get success value from a Failure.'),
  };
}