Either<LEFT, RIGHT> class

Represents a union type of LEFT and RIGHT. Holds either a LEFT value or a RIGHT value, but never both.

Constructors

Either.left(LEFT value)
Produces an Either containing a value of LEFT.
factory
Either.right(RIGHT value)
Produces an Either containing a value of RIGHT.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isLeft bool
Tells whether this contains an instance of LEFT object.
no setter
isRight bool
Tells whether this contains an instance of RIGHT.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

ifLeft<RETURN>(RETURN onLeft(LEFT left)) Option<RETURN>
Calls onLeft if this.isLeft and returns its value in an Option.
ifLeftAsync<RETURN>(Future<RETURN> onLeft(LEFT left)) Future<Option<RETURN>>
Async version of Either.ifLeft.
ifRight<RETURN>(RETURN onRight(RIGHT right)) Option<RETURN>
Calls onRight if this.isRight and returns its value in an Option.
ifRightAsync<RETURN>(Future<RETURN> onRight(RIGHT right)) Future<Option<RETURN>>
Async version of Either.ifRight.
left(LEFT fallback) → LEFT
Returns left value if present, else fallback.
leftOr(LEFT fallback()) → LEFT
Returns left value if present, else value produced by fallback.
leftOrAsync(Future<LEFT> fallback()) Future<LEFT>
Async version of Either.leftOr.
leftUnsafe() → LEFT?
Returns the left value as nullable. Only use this if necessary.
match<RETURN>({required RETURN onLeft(LEFT left), required RETURN onRight(RIGHT right)}) → RETURN
Calls the matching function and returns its value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
Returns right value if present, else fallback.
rightOr(RIGHT fallback()) → RIGHT
Returns right value if present, else value produced by fallback.
rightOrAsync(Future<RIGHT> fallback()) Future<RIGHT>
Async version of Either.rightOr.
rightUnsafe() → RIGHT?
Returns the right value as nullable. Only use this if necessary.
toString() String
A string representation of this object.
inherited

Operators

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