Right<L, R> class

The right side of the disjoint union, as opposed to the Left side.

Inheritance
Available Extensions
Annotations
  • @sealed

Constructors

Construct a Right with value.
const

Properties

hashCode int
The hash code for this object.
no setteroverride
isLeft bool
Returns true if this is a Left, false otherwise. Used only for performance instead of fold.
no setteroverride
isRight bool
Returns true if this is a Right, false otherwise. Used only for performance instead of fold.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → R
The value inside Right.
final

Methods

all(bool predicate(R value)) bool
Returns true if Left or returns the result of the application of the given predicate to the Right value.
inherited
bimap<C, D>({required C leftOperation(L value), required D rightOperation(R value)}) Either<C, D>
Map over Left and Right of this Either
inherited
exists(bool predicate(R value)) bool
Returns false if Left or returns the result of the application of the given predicate to the Right value.
inherited
findOrNull(bool predicate(R value)) → R?
Returns the Right.value matching the given predicate, or null if this is a Left or Right.value does not match.
inherited
flatMap<C>(Either<L, C> f(R value)) Either<L, C>
Binds the given function across Right.
inherited
fold<C>({required C ifLeft(L value), required C ifRight(R value)}) → C
Applies ifLeft if this is a Left or ifRight if this is a Right.
inherited
foldLeft<C>(C initial, C rightOperation(C acc, R element)) → C
If this is a Right, applies ifRight with initial and Right.value. Returns initial otherwise.
inherited
getOrElse(R defaultValue()) → R
Returns the value from this Right or the given argument if this is a Left.
inherited
getOrHandle(R defaultValue(L value)) → R
Returns the value from this Right or allows clients to transform the value of Left to the final result.
inherited
handleError(R f(L value)) Either<L, R>
Handle any error, potentially recovering from it, by mapping it to an Either value.
inherited
handleErrorWith<C>(Either<C, R> f(L value)) Either<C, R>
Handle any error, potentially recovering from it, by mapping it to an Either value.
inherited
map<C>(C f(R value)) Either<L, C>
The given function is applied if this is a Right.
inherited
mapLeft<C>(C f(L value)) Either<C, R>
The given function is applied if this is a Left.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orNull() → R?
Returns the Right's value if it exists, otherwise null.
inherited
redeem<C>({required C leftOperation(L value), required C rightOperation(R value)}) Either<L, C>
Redeem an Either to an Either by resolving the error or mapping the value R to C.
inherited
redeemWith<C, D>({required Either<C, D> leftOperation(L value), required Either<C, D> rightOperation(R value)}) Either<C, D>
Redeem an Either to an Either by resolving the error or mapping the value R to C with an Either.
inherited
swap() Either<R, L>
If this is a Left, then return the left value in Right or vice versa.
inherited
tap(void f(R value)) Either<L, R>
The given function is applied as a fire and forget effect if this is a Right. When applied the result is ignored and the original Either value is returned.
inherited
tapLeft(void f(L value)) Either<L, R>
The given function is applied as a fire and forget effect if this is a Left. When applied the result is ignored and the original Either value is returned.
inherited
toString() String
A string representation of this object.
override
when<C>({required C ifLeft(Left<L, R> left), required C ifRight(Right<L, R> right)}) → C
Applies ifLeft if this is a Left or ifRight if this is a Right.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override