discontinuedPackage flutter_ai_operator has been discontinued and replaced by flutter_app_copilot.

Either<L, R> class sealed

Represents a value of one of two possible types. Instances of Either are either an instance of Left or Right.

Left is used for "failure". Right is used for "success".

Properties

hashCode → int
The hash code for this object.
no setteroverride
isLeft → bool
Represents the left side of Either class which by convention is a "Failure".
no setter
isRight → bool
Represents the right side of Either class which by convention is a "Success"
no setter
left → L
Get Left value, may throw an exception when the value is Right
no setter
Get Right value, may throw an exception when the value is Left
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

either<TL, TR>(TL fnL(L left), TR fnR(R right)) → Either<TL, TR>
Transform values of Left and Right
fold<T>(T fnL(L left), T fnR(R right)) → T
Fold Left and Right into the value of one type
map<TR>(TR fnR(R right)) → Either<L, TR>
Transform value of Right
mapAsync<TR>(FutureOr<TR> fnR(R right)) → Future<Either<L, TR>>
Transform value of Right
mapLeft<TL>(TL fnL(L left)) → Either<TL, R>
Transform value of Left
mapLeftAsync<TL>(FutureOr<TL> fnL(L left)) → Future<Either<TL, R>>
Transform value of Left
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
swap() → Either<R, L>
Swap Left and Right
then<TR>(Either<L, TR> fnR(R right)) → Either<L, TR>
Transform value of Right when transformation may be finished with an error
thenAsync<TR>(FutureOr<Either<L, TR>> fnR(R right)) → Future<Either<L, TR>>
Transform value of Right when transformation may be finished with an error
thenLeft<TL>(Either<TL, R> fnL(L left)) → Either<TL, R>
Transform value of Left when transformation may be finished with an Right
thenLeftAsync<TL>(FutureOr<Either<TL, R>> fnL(L left)) → Future<Either<TL, R>>
Transform value of Left when transformation may be finished with an Right
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object obj) → bool
The equality operator.
override

Static Methods

cond<L, R>(bool test, L leftValue, R rightValue) → Either<L, R>
If the condition is true then return rightValue in Right else leftValue in Left
condLazy<L, R>(bool test, Lazy<L> leftValue, Lazy<R> rightValue) → Either<L, R>
If the condition is true then return rightValue in Right else leftValue in Left
tryCatch<L, R, Err extends Object>(L onError(Err err), R fnR()) → Either<L, R>
Constructs a new Either from a function that might throw
tryExcept<Err extends Object, R>(R fnR()) → Either<Err, R>
Constructs a new Either from a function that might throw