Right<L, R> class
A concrete implementation of Either that represents the successful value (Right) in a computation.
Commonly used in functional programming to wrap a successful result, while the Left represents a failure or error.
Example usage:
Either<String, int> result = Right(42);
print(result.isRight()); // true
Properties
Methods
-
flatMap<
R2> (Either< L, R2> f(R right)) → Either<L, R2> -
Applies the given function
fto the contained value, and flattens the result.override -
fold<
B> (B ifLeft(L left), B ifRight(R right)) → B -
Applies
ifRightto the contained value and returns its result.override -
getLeft(
) → L -
Throws an Exception because this is a Right and does not contain a Left value.
override
-
getRight(
) → R -
Returns the contained value.
override
-
isLeft(
) → bool -
Always returns
falsebecause this is a Right.override -
isRight(
) → bool -
Always returns
truebecause this is a Right.override -
map<
R2> (R2 f(R right)) → Either< L, R2> -
Transforms the contained value using the provided function
f, returning a new Right.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited